diff --git a/gramps/gui/clipboard.py b/gramps/gui/clipboard.py
index f5138bdec..dc4c81a02 100644
--- a/gramps/gui/clipboard.py
+++ b/gramps/gui/clipboard.py
@@ -48,7 +48,7 @@ from gi.repository import GdkPixbuf
#-------------------------------------------------------------------------
from gen.const import IMAGE_DIR, URL_MANUAL_PAGE
from gen.config import config
-import gen.lib
+from gramps.gen.lib import NoteType
from gramps.gen.datehandler import get_date
from gui.display import display_help
from gui.managedwindow import ManagedWindow
@@ -491,7 +491,7 @@ class ClipCitation(ClipHandleWrapper):
notelist = map(self._db.get_note_from_handle,
citation.get_note_list())
srctxtlist = [note for note in notelist
- if note.get_type() == gen.lib.NoteType.SOURCE_TEXT]
+ if note.get_type() == NoteType.SOURCE_TEXT]
page = citation.get_page()
if not page:
page = _('not available|NA')
diff --git a/gramps/gui/configure.py b/gramps/gui/configure.py
index 8d36682aa..a5a8b9cf8 100644
--- a/gramps/gui/configure.py
+++ b/gramps/gui/configure.py
@@ -56,7 +56,7 @@ from gen.utils.file import get_unicode_path_from_file_chooser
from gen.utils.alive import update_constants
from gen.utils.keyword import (get_keywords, get_translation_from_keyword,
get_translations, get_keyword_from_translation)
-import gen.lib
+from gramps.gen.lib import Date, FamilyRelType
from gen.lib import Name, Surname, NameOriginType
from gui.managedwindow import ManagedWindow
from gui.widgets import MarkupLabel, BasicLabel
@@ -982,7 +982,7 @@ class GrampsPreferences(ConfigureDialog):
# Calendar format on report:
obox = Gtk.ComboBoxText()
- map(obox.append_text, gen.lib.Date.ui_calendar_names)
+ map(obox.append_text, Date.ui_calendar_names)
active = config.get('preferences.calendar-format-report')
if active >= len(formats):
active = 0
@@ -1008,7 +1008,7 @@ class GrampsPreferences(ConfigureDialog):
# Default Family Relationship
obox = Gtk.ComboBoxText()
- formats = gen.lib.FamilyRelType().get_standard_names()
+ formats = FamilyRelType().get_standard_names()
map(obox.append_text, formats)
obox.set_active(config.get('preferences.family-relation-type'))
obox.connect('changed',
diff --git a/gramps/gui/editors/displaytabs/addrembedlist.py b/gramps/gui/editors/displaytabs/addrembedlist.py
index ae833450b..82a514f45 100644
--- a/gramps/gui/editors/displaytabs/addrembedlist.py
+++ b/gramps/gui/editors/displaytabs/addrembedlist.py
@@ -37,7 +37,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Address
from gen.errors import WindowActiveError
from gui.ddtargets import DdTargets
from addressmodel import AddressModel
@@ -107,7 +107,7 @@ class AddrEmbedList(EmbeddedList):
already exists (WindowActiveError), we ignore it. This prevents
the dialog from coming up twice on the same object.
"""
- addr = gen.lib.Address()
+ addr = Address()
try:
from gui.editors import EditAddress
EditAddress(self.dbstate, self.uistate, self.track,
diff --git a/gramps/gui/editors/displaytabs/attrembedlist.py b/gramps/gui/editors/displaytabs/attrembedlist.py
index c4ae5e716..285403c4b 100644
--- a/gramps/gui/editors/displaytabs/attrembedlist.py
+++ b/gramps/gui/editors/displaytabs/attrembedlist.py
@@ -33,7 +33,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Attribute
from gen.errors import WindowActiveError
from gui.ddtargets import DdTargets
from attrmodel import AttrModel
@@ -87,7 +87,7 @@ class AttrEmbedList(EmbeddedList):
def add_button_clicked(self, obj):
pname = ''
- attr = gen.lib.Attribute()
+ attr = Attribute()
try:
self.get_editor()(
self.dbstate, self.uistate, self.track, attr,
diff --git a/gramps/gui/editors/displaytabs/childmodel.py b/gramps/gui/editors/displaytabs/childmodel.py
index 865b23f47..71b070251 100644
--- a/gramps/gui/editors/displaytabs/childmodel.py
+++ b/gramps/gui/editors/displaytabs/childmodel.py
@@ -36,7 +36,7 @@ import cgi
from gramps.gen.datehandler import get_date
from gen.display.name import displayer as name_displayer
from gen.utils.string import gender as gender_map
-import gen.lib
+from gramps.gen.lib import EventType
from gen.utils.db import get_birth_or_fallback, get_death_or_fallback
#-------------------------------------------------------------------------
@@ -73,7 +73,7 @@ class ChildModel(Gtk.ListStore):
def column_birth_day(self, data):
birth = get_birth_or_fallback(self.db, data)
if birth:
- if birth.get_type() == gen.lib.EventType.BIRTH:
+ if birth.get_type() == EventType.BIRTH:
return get_date(birth)
else:
return '%s' % cgi.escape(get_date(birth))
@@ -96,7 +96,7 @@ class ChildModel(Gtk.ListStore):
def column_death_day(self, data):
death = get_death_or_fallback(self.db, data)
if death:
- if death.get_type() == gen.lib.EventType.DEATH:
+ if death.get_type() == EventType.DEATH:
return get_date(death)
else:
return '%s' % cgi.escape(get_date(death))
diff --git a/gramps/gui/editors/displaytabs/citationembedlist.py b/gramps/gui/editors/displaytabs/citationembedlist.py
index 29a8c40fe..74b68e1f4 100644
--- a/gramps/gui/editors/displaytabs/citationembedlist.py
+++ b/gramps/gui/editors/displaytabs/citationembedlist.py
@@ -43,7 +43,7 @@ from gi.repository import GObject
#
#-------------------------------------------------------------------------
from gen.errors import WindowActiveError
-import gen.lib
+from gramps.gen.lib import Citation, Source
from gen.lib import Source, Citation
from gui.dbguielement import DbGUIElement
from gui.selectors import SelectorFactory
@@ -136,7 +136,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
try:
from gui.editors import EditCitation
EditCitation(self.dbstate, self.uistate, self.track,
- gen.lib.Citation(), gen.lib.Source(),
+ Citation(), Source(),
self.add_callback, self.callertitle)
except WindowActiveError:
pass
@@ -164,7 +164,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
try:
from gui.editors import EditCitation
EditCitation(self.dbstate, self.uistate, self.track,
- gen.lib.Citation(), object,
+ Citation(), object,
callback=self.add_callback,
callertitle=self.callertitle)
except WindowActiveError:
@@ -267,7 +267,7 @@ class CitationEmbedList(EmbeddedList, DbGUIElement):
try:
from gui.editors import EditCitation
EditCitation(self.dbstate, self.uistate, self.track,
- gen.lib.Citation(), object,
+ Citation(), object,
callback=self.add_callback,
callertitle=self.callertitle)
except WindowActiveError:
diff --git a/gramps/gui/editors/displaytabs/eventembedlist.py b/gramps/gui/editors/displaytabs/eventembedlist.py
index 906286133..38a337a3b 100644
--- a/gramps/gui/editors/displaytabs/eventembedlist.py
+++ b/gramps/gui/editors/displaytabs/eventembedlist.py
@@ -35,7 +35,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Event, EventRef, EventRoleType, EventType
from gen.errors import WindowActiveError
from gui.ddtargets import DdTargets
from groupembeddedlist import GroupEmbeddedList
@@ -198,8 +198,8 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
def default_types(self):
return [
- gen.lib.EventType(gen.lib.EventType.MARRIAGE),
- gen.lib.EventType(gen.lib.EventType.DIVORCE),
+ EventType(EventType.MARRIAGE),
+ EventType(EventType.DIVORCE),
]
def default_type(self):
@@ -215,16 +215,16 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
_std_types = self.default_types()
for etype in _std_types:
if etype not in type_list:
- return gen.lib.EventType(etype)
+ return EventType(etype)
return _std_types[0]
def default_role(self):
- return gen.lib.EventRoleType(gen.lib.EventRoleType.FAMILY)
+ return EventRoleType(EventRoleType.FAMILY)
def add_button_clicked(self, obj):
try:
- ref = gen.lib.EventRef()
- event = gen.lib.Event()
+ ref = EventRef()
+ event = Event()
ref.set_role(self.default_role())
event.set_type(self.default_type())
self.get_ref_editor()(
@@ -250,7 +250,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
event = sel.run()
if event:
try:
- ref = gen.lib.EventRef()
+ ref = EventRef()
ref.set_role(self.default_role())
self.get_ref_editor()(
self.dbstate, self.uistate, self.track,
@@ -347,7 +347,7 @@ class EventEmbedList(DbGUIElement, GroupEmbeddedList):
def handle_extra_type(self, objtype, obj):
try:
- ref = gen.lib.EventRef()
+ ref = EventRef()
event = self.dbstate.db.get_event_from_handle(obj)
ref.set_role(self.default_role())
self.get_ref_editor()(
diff --git a/gramps/gui/editors/displaytabs/familyldsembedlist.py b/gramps/gui/editors/displaytabs/familyldsembedlist.py
index ba6270d74..235bb6677 100644
--- a/gramps/gui/editors/displaytabs/familyldsembedlist.py
+++ b/gramps/gui/editors/displaytabs/familyldsembedlist.py
@@ -33,7 +33,7 @@ from gen.ggettext import gettext as _
#
#-------------------------------------------------------------------------
from ldsembedlist import LdsEmbedList
-import gen.lib
+from gramps.gen.lib import LdsOrd
#-------------------------------------------------------------------------
#
@@ -63,6 +63,6 @@ class FamilyLdsEmbedList(LdsEmbedList):
return EditFamilyLdsOrd
def new_data(self):
- lds = gen.lib.LdsOrd()
- lds.set_type(gen.lib.LdsOrd.SEAL_TO_SPOUSE)
+ lds = LdsOrd()
+ lds.set_type(LdsOrd.SEAL_TO_SPOUSE)
return lds
diff --git a/gramps/gui/editors/displaytabs/gallerytab.py b/gramps/gui/editors/displaytabs/gallerytab.py
index ffce2304e..3faad8912 100644
--- a/gramps/gui/editors/displaytabs/gallerytab.py
+++ b/gramps/gui/editors/displaytabs/gallerytab.py
@@ -52,7 +52,7 @@ from gi.repository import GObject
from gramps.gui.utils import is_right_click, open_file_with_default_application
from gui.dbguielement import DbGUIElement
from gui.selectors import SelectorFactory
-import gen.lib
+from gramps.gen.lib import MediaObject, MediaRef
from gen.db import DbTxn
from gen.utils.file import (media_path_full, media_path, relative_path,
fix_encoding)
@@ -277,7 +277,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
try:
from gui.editors import EditMediaRef
EditMediaRef(self.dbstate, self.uistate, self.track,
- gen.lib.MediaObject(), gen.lib.MediaRef(),
+ MediaObject(), MediaRef(),
self.add_callback)
except WindowActiveError:
pass
@@ -319,7 +319,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
sel = SelectObject(self.dbstate, self.uistate, self.track)
src = sel.run()
if src:
- sref = gen.lib.MediaRef()
+ sref = MediaRef()
try:
from gui.editors import EditMediaRef
EditMediaRef(self.dbstate, self.uistate, self.track,
@@ -492,7 +492,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
self._handle_drag(row, obj)
self.rebuild()
elif mytype == DdTargets.MEDIAOBJ.drag_type:
- oref = gen.lib.MediaRef()
+ oref = MediaRef()
oref.set_reference_handle(obj)
self.get_data().append(oref)
self.changed = True
@@ -515,7 +515,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
mime = gen.mime.get_type(name)
if not gen.mime.is_valid_type(mime):
return
- photo = gen.lib.MediaObject()
+ photo = MediaObject()
base_dir = unicode(media_path(self.dbstate.db))
if os.path.exists(base_dir):
name = relative_path(name, base_dir)
@@ -527,7 +527,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
with DbTxn(_("Drag Media Object"),
self.dbstate.db) as trans:
self.dbstate.db.add_object(photo, trans)
- oref = gen.lib.MediaRef()
+ oref = MediaRef()
oref.set_reference_handle(photo.get_handle())
self.get_data().append(oref)
self.changed = True
diff --git a/gramps/gui/editors/displaytabs/ldsembedlist.py b/gramps/gui/editors/displaytabs/ldsembedlist.py
index 8e798b5ae..6f37ef03a 100644
--- a/gramps/gui/editors/displaytabs/ldsembedlist.py
+++ b/gramps/gui/editors/displaytabs/ldsembedlist.py
@@ -33,7 +33,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import LdsOrd
from gen.errors import WindowActiveError
from ldsmodel import LdsModel
from embeddedlist import EmbeddedList
@@ -76,7 +76,7 @@ class LdsEmbedList(EmbeddedList):
return EditLdsOrd
def new_data(self):
- return gen.lib.LdsOrd()
+ return LdsOrd()
def get_data(self):
return self.data
diff --git a/gramps/gui/editors/displaytabs/locationembedlist.py b/gramps/gui/editors/displaytabs/locationembedlist.py
index fbbbdc5b5..2093cbbcd 100644
--- a/gramps/gui/editors/displaytabs/locationembedlist.py
+++ b/gramps/gui/editors/displaytabs/locationembedlist.py
@@ -33,7 +33,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Location
from gen.errors import WindowActiveError
from gui.ddtargets import DdTargets
from locationmodel import LocationModel
@@ -73,7 +73,7 @@ class LocationEmbedList(EmbeddedList):
return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5))
def add_button_clicked(self, obj):
- loc = gen.lib.Location()
+ loc = Location()
try:
from gui.editors import EditLocation
EditLocation(self.dbstate, self.uistate, self.track,
diff --git a/gramps/gui/editors/displaytabs/nameembedlist.py b/gramps/gui/editors/displaytabs/nameembedlist.py
index 1507ffdce..396cea713 100644
--- a/gramps/gui/editors/displaytabs/nameembedlist.py
+++ b/gramps/gui/editors/displaytabs/nameembedlist.py
@@ -41,7 +41,7 @@ from gen.ggettext import gettext as _
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Name, Surname
from gen.errors import WindowActiveError
from gui.ddtargets import DdTargets
from namemodel import NameModel
@@ -139,7 +139,7 @@ class NameEmbedList(GroupEmbeddedList):
remove = [altname for altname in self.data if altname.is_equal(name)]
map(self.data.remove, remove)
#only non empty name should move to alternative names
- if not name.is_equal(gen.lib.Name()):
+ if not name.is_equal(Name()):
self.data.append(pname)
self.rebuild()
self.callback()
@@ -152,9 +152,9 @@ class NameEmbedList(GroupEmbeddedList):
self.tree.expand_all()
def add_button_clicked(self, obj):
- name = gen.lib.Name()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
try:
from gui.editors import EditName
diff --git a/gramps/gui/editors/displaytabs/notetab.py b/gramps/gui/editors/displaytabs/notetab.py
index b9c2475a9..bf7bddecd 100644
--- a/gramps/gui/editors/displaytabs/notetab.py
+++ b/gramps/gui/editors/displaytabs/notetab.py
@@ -40,7 +40,7 @@ from gi.repository import GObject
#
#-------------------------------------------------------------------------
from gen.errors import WindowActiveError
-import gen.lib
+from gramps.gen.lib import Note
from gui.dbguielement import DbGUIElement
from gui.selectors import SelectorFactory
from notemodel import NoteModel
@@ -127,7 +127,7 @@ class NoteTab(EmbeddedList, DbGUIElement):
If the window already exists (WindowActiveError), we ignore it.
This prevents the dialog from coming up twice on the same object.
"""
- note = gen.lib.Note()
+ note = Note()
if self.notetype :
note.set_type(self.notetype)
try:
diff --git a/gramps/gui/editors/displaytabs/personeventembedlist.py b/gramps/gui/editors/displaytabs/personeventembedlist.py
index 19ee65879..b51ade0eb 100644
--- a/gramps/gui/editors/displaytabs/personeventembedlist.py
+++ b/gramps/gui/editors/displaytabs/personeventembedlist.py
@@ -34,7 +34,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventRoleType, EventType
from gen.display.name import displayer as name_displayer
from eventembedlist import EventEmbedList
from eventrefmodel import EventRefModel
@@ -96,13 +96,13 @@ class PersonEventEmbedList(EventEmbedList):
return self._data
def default_role(self):
- return gen.lib.EventRoleType(gen.lib.EventRoleType.PRIMARY)
+ return EventRoleType(EventRoleType.PRIMARY)
def default_types(self):
return [
- gen.lib.EventType(gen.lib.EventType.BIRTH),
- gen.lib.EventType(gen.lib.EventType.DEATH),
- gen.lib.EventType(gen.lib.EventType.BURIAL),
+ EventType(EventType.BIRTH),
+ EventType(EventType.DEATH),
+ EventType(EventType.BURIAL),
]
def get_ref_editor(self):
diff --git a/gramps/gui/editors/displaytabs/personrefembedlist.py b/gramps/gui/editors/displaytabs/personrefembedlist.py
index 4372036a3..a70aa00af 100644
--- a/gramps/gui/editors/displaytabs/personrefembedlist.py
+++ b/gramps/gui/editors/displaytabs/personrefembedlist.py
@@ -33,7 +33,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import PersonRef
from gen.errors import WindowActiveError
from gui.ddtargets import DdTargets
from personrefmodel import PersonRefModel
@@ -84,7 +84,7 @@ class PersonRefEmbedList(EmbeddedList):
def add_button_clicked(self, obj):
from gui.editors import EditPersonRef
try:
- ref = gen.lib.PersonRef()
+ ref = PersonRef()
ref.rel = _('Godfather')
EditPersonRef(
self.dbstate, self.uistate, self.track,
@@ -119,7 +119,7 @@ class PersonRefEmbedList(EmbeddedList):
"""
from gui.editors import EditPersonRef
try:
- ref = gen.lib.PersonRef(obj)
+ ref = PersonRef(obj)
ref.rel = _('Unknown')
EditPersonRef(
self.dbstate, self.uistate, self.track,
diff --git a/gramps/gui/editors/displaytabs/repoembedlist.py b/gramps/gui/editors/displaytabs/repoembedlist.py
index 98da68b00..d17bec4cd 100644
--- a/gramps/gui/editors/displaytabs/repoembedlist.py
+++ b/gramps/gui/editors/displaytabs/repoembedlist.py
@@ -33,7 +33,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import RepoRef, Repository
from gui.dbguielement import DbGUIElement
from gui.selectors import SelectorFactory
from gen.errors import WindowActiveError
@@ -102,7 +102,7 @@ class RepoEmbedList(EmbeddedList, DbGUIElement):
def handle_extra_type(self, objtype, obj):
from gui.editors import EditRepoRef
try:
- ref = gen.lib.RepoRef()
+ ref = RepoRef()
repo = self.dbstate.db.get_repository_from_handle(obj)
EditRepoRef(
self.dbstate, self.uistate, self.track,
@@ -112,8 +112,8 @@ class RepoEmbedList(EmbeddedList, DbGUIElement):
def add_button_clicked(self, obj):
from gui.editors import EditRepoRef
- ref = gen.lib.RepoRef()
- repo = gen.lib.Repository()
+ ref = RepoRef()
+ repo = Repository()
try:
EditRepoRef(
self.dbstate, self.uistate, self.track,
@@ -133,7 +133,7 @@ class RepoEmbedList(EmbeddedList, DbGUIElement):
if repo:
try:
from gui.editors import EditRepoRef
- ref = gen.lib.RepoRef()
+ ref = RepoRef()
EditRepoRef(self.dbstate,
self.uistate,
self.track,
diff --git a/gramps/gui/editors/displaytabs/webembedlist.py b/gramps/gui/editors/displaytabs/webembedlist.py
index d51f65fd0..f3f9b4ece 100644
--- a/gramps/gui/editors/displaytabs/webembedlist.py
+++ b/gramps/gui/editors/displaytabs/webembedlist.py
@@ -34,7 +34,7 @@ from gi.repository import GObject
# GRAMPS classes
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Url
from gen.errors import WindowActiveError
from gui.ddtargets import DdTargets
from webmodel import WebModel
@@ -83,7 +83,7 @@ class WebEmbedList(EmbeddedList):
def add_button_clicked(self, obj):
from gui.editors import EditUrl
- url = gen.lib.Url()
+ url = Url()
try:
EditUrl(self.dbstate, self.uistate, self.track,
'', url, self.add_callback)
diff --git a/gramps/gui/editors/editcitation.py b/gramps/gui/editors/editcitation.py
index ccff7ef85..3487f03a2 100644
--- a/gramps/gui/editors/editcitation.py
+++ b/gramps/gui/editors/editcitation.py
@@ -40,7 +40,7 @@ LOG = logging.getLogger(".citation")
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Citation, NoteType, Source
from gen.db import DbTxn
from editprimary import EditPrimary
@@ -127,7 +127,7 @@ class EditCitation(EditPrimary):
It is used by the base class L{EditPrimary}.
"""
- return gen.lib.Citation()
+ return Citation()
def get_menu_title(self):
"""
@@ -269,11 +269,11 @@ class EditCitation(EditPrimary):
self.glade.get_object('confidence'),
self.obj.set_confidence_level,
self.obj.get_confidence_level, [
- (_('Very Low'), gen.lib.Citation.CONF_VERY_LOW),
- (_('Low'), gen.lib.Citation.CONF_LOW),
- (_('Normal'), gen.lib.Citation.CONF_NORMAL),
- (_('High'), gen.lib.Citation.CONF_HIGH),
- (_('Very High'), gen.lib.Citation.CONF_VERY_HIGH)],
+ (_('Very Low'), Citation.CONF_VERY_LOW),
+ (_('Low'), Citation.CONF_LOW),
+ (_('Normal'), Citation.CONF_NORMAL),
+ (_('High'), Citation.CONF_HIGH),
+ (_('Very High'), Citation.CONF_VERY_HIGH)],
self.db.readonly)
self.ref_privacy = PrivacyButton(
@@ -319,7 +319,7 @@ class EditCitation(EditPrimary):
self.comment_tab = NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(), self.get_menu_title(),
- notetype=gen.lib.NoteType.CITATION)
+ notetype=NoteType.CITATION)
self._add_tab(notebook_ref, self.comment_tab)
self.track_ref_for_deletion("comment_tab")
@@ -349,7 +349,7 @@ class EditCitation(EditPrimary):
self.note_tab = NoteTab(self.dbstate, self.uistate, self.track,
self.source.get_note_list(),
self.get_menu_title(),
- notetype=gen.lib.NoteType.SOURCE)
+ notetype=NoteType.SOURCE)
self._add_tab(notebook_src, self.note_tab)
self.track_ref_for_deletion("note_tab")
@@ -454,7 +454,7 @@ class EditCitation(EditPrimary):
self.close()
def source_is_empty(self, obj):
- empty_object = gen.lib.Source()
+ empty_object = Source()
return cmp(obj.serialize()[1:],
empty_object.serialize()[1:]) == 0
@@ -513,11 +513,11 @@ class EditCitation(EditPrimary):
if orig:
cmp_obj = orig
else:
- cmp_obj = gen.lib.Source()
+ cmp_obj = Source()
return cmp(cmp_obj.serialize()[1:],
self.source.serialize()[1:]) != 0
else:
- cmp_obj = gen.lib.Source()
+ cmp_obj = Source()
return cmp(cmp_obj.serialize()[1:],
self.source.serialize()[1:]) != 0
diff --git a/gramps/gui/editors/editevent.py b/gramps/gui/editors/editevent.py
index 2af4f924a..9d8ba7feb 100644
--- a/gramps/gui/editors/editevent.py
+++ b/gramps/gui/editors/editevent.py
@@ -42,7 +42,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gen.const import URL_MANUAL_PAGE
-import gen.lib
+from gramps.gen.lib import Event, NoteType
from gen.db import DbTxn
from gui.display import display_help
from editprimary import EditPrimary
@@ -83,7 +83,7 @@ class EditEvent(EditPrimary):
self.commit_event = self.db.commit_event
def empty_object(self):
- return gen.lib.Event()
+ return Event()
def get_menu_title(self):
handle = self.obj.get_handle()
@@ -184,7 +184,7 @@ class EditEvent(EditPrimary):
self.uistate,
self.track,
self.obj.get_note_list(),
- notetype=gen.lib.NoteType.EVENT)
+ notetype=NoteType.EVENT)
self._add_tab(notebook, self.note_list)
diff --git a/gramps/gui/editors/editeventref.py b/gramps/gui/editors/editeventref.py
index 218f44185..7c47d3483 100644
--- a/gramps/gui/editors/editeventref.py
+++ b/gramps/gui/editors/editeventref.py
@@ -35,7 +35,7 @@ from gen.ggettext import gettext as _
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventType, NoteType
from gen.db import DbTxn
from gui.glade import Glade
from displaytabs import (CitationEmbedList, NoteTab, GalleryTab,
@@ -197,7 +197,7 @@ class EditEventRef(EditReference):
self.uistate,
self.track,
self.source.get_note_list(),
- notetype=gen.lib.NoteType.EVENT)
+ notetype=NoteType.EVENT)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
@@ -205,7 +205,7 @@ class EditEventRef(EditReference):
self.uistate,
self.track,
self.source_ref.get_note_list(),
- notetype=gen.lib.NoteType.EVENTREF)
+ notetype=NoteType.EVENTREF)
self._add_tab(notebook_ref, self.note_ref_tab)
self.track_ref_for_deletion("note_ref_tab")
@@ -270,5 +270,5 @@ class EditFamilyEventRef(EditEventRef):
self.add_event = self.db.add_family_event
def get_custom_events(self):
- return [gen.lib.EventType((gen.lib.EventType.CUSTOM,val))
+ return [EventType((EventType.CUSTOM,val))
for val in self.dbstate.db.get_family_event_types()]
diff --git a/gramps/gui/editors/editfamily.py b/gramps/gui/editors/editfamily.py
index 8d7d460a9..6bb090a1b 100644
--- a/gramps/gui/editors/editfamily.py
+++ b/gramps/gui/editors/editfamily.py
@@ -62,7 +62,7 @@ from gi.repository import GObject
#-------------------------------------------------------------------------
from gen.config import config
from gen.display.name import displayer as name_displayer
-import gen.lib
+from gramps.gen.lib import ChildRef, Family, Name, NoteType, Person, Surname
from gen.db import DbTxn
from gen.errors import WindowActiveError
from gramps.gen.datehandler import displayer
@@ -163,7 +163,7 @@ class ChildEmbedList(EmbeddedList):
(0, 8), (0, 9)]
def add_button_clicked(self, obj=None):
- person = gen.lib.Person()
+ person = Person()
autoname = config.get('behavior.surname-guessing')
#_("Father's surname"),
#_("None"),
@@ -189,7 +189,7 @@ class ChildEmbedList(EmbeddedList):
self.new_child_added(person)
def new_child_added(self, person):
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = person.get_handle()
self.family.add_child_ref(ref)
self.rebuild()
@@ -211,7 +211,7 @@ class ChildEmbedList(EmbeddedList):
person = sel.run()
if person:
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = person.get_handle()
self.family.add_child_ref(ref)
self.rebuild()
@@ -258,9 +258,9 @@ class ChildEmbedList(EmbeddedList):
"""
Child inherits name from father
"""
- name = gen.lib.Name()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
father_handle = self.family.get_father_handle()
if father_handle:
@@ -269,9 +269,9 @@ class ChildEmbedList(EmbeddedList):
return name
def no_name(self):
- name = gen.lib.Name()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
return name
@@ -279,9 +279,9 @@ class ChildEmbedList(EmbeddedList):
"""
Child inherits name from father and mother
"""
- name = gen.lib.Name()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
if self.family:
father_handle = self.family.get_father_handle()
@@ -295,7 +295,7 @@ class ChildEmbedList(EmbeddedList):
if not mother:
preset_name(father, name)
#we take first surname, and keep that
- mothername = gen.lib.Name()
+ mothername = Name()
preset_name(mother, mothername)
preset_name(father, name)
mothersurname = mothername.get_surname_list()[0]
@@ -312,7 +312,7 @@ class FastMaleFilter(object):
def match(self, handle, db):
value = self.db.get_raw_person_data(handle)
- return value[2] == gen.lib.Person.MALE
+ return value[2] == Person.MALE
class FastFemaleFilter(object):
@@ -321,7 +321,7 @@ class FastFemaleFilter(object):
def match(self, handle, db):
value = self.db.get_raw_person_data(handle)
- return value[2] == gen.lib.Person.FEMALE
+ return value[2] == Person.FEMALE
#-------------------------------------------------------------------------
#
@@ -373,7 +373,7 @@ class EditFamily(EditPrimary):
EditPrimary._cleanup_on_exit(self)
def empty_object(self):
- return gen.lib.Family()
+ return Family()
def _local_init(self):
self.build_interface()
@@ -678,7 +678,7 @@ class EditFamily(EditPrimary):
self.track,
self.obj.get_note_list(),
self.get_menu_title(),
- notetype=gen.lib.NoteType.FAMILY)
+ notetype=NoteType.FAMILY)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
@@ -715,8 +715,8 @@ class EditFamily(EditPrimary):
self.mbutton_del, self.mbutton_edit)
def add_mother_clicked(self, obj):
- person = gen.lib.Person()
- person.set_gender(gen.lib.Person.FEMALE)
+ person = Person()
+ person.set_gender(Person.FEMALE)
autoname = config.get('behavior.surname-guessing')
#_("Father's surname"),
#_("None"),
@@ -731,8 +731,8 @@ class EditFamily(EditPrimary):
self.new_mother_added)
def add_father_clicked(self, obj):
- person = gen.lib.Person()
- person.set_gender(gen.lib.Person.MALE)
+ person = Person()
+ person.set_gender(Person.MALE)
autoname = config.get('behavior.surname-guessing')
#_("Father's surname"),
#_("None"),
@@ -786,7 +786,7 @@ class EditFamily(EditPrimary):
self.update_mother(person.handle)
def on_change_father(self, selector_window, obj):
- if obj.__class__ == gen.lib.Person:
+ if obj.__class__ == Person:
try:
person = obj
self.obj.set_father_handle(person.get_handle())
@@ -801,7 +801,7 @@ class EditFamily(EditPrimary):
log.warn(
"Object selector returned obj.__class__ = %s, it should "
"have been of type %s." % (obj.__class__.__name__,
- gen.lib.Person.__name__))
+ Person.__name__))
selector_window.close()
@@ -1103,9 +1103,9 @@ class EditFamily(EditPrimary):
"""
Default surname guess.
"""
- name = gen.lib.Name()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
return name
@@ -1115,9 +1115,9 @@ class EditFamily(EditPrimary):
and return their name for the father.
"""
# for each child, find one with a last name
- name = gen.lib.Name()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
for ref in self.obj.get_child_ref_list():
child = self.db.get_person_from_handle(ref.ref)
@@ -1133,9 +1133,9 @@ class EditFamily(EditPrimary):
parent = "mother" | "father"
"""
- name = gen.lib.Name()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
# for each child, find one with a last name
for ref in self.obj.get_child_ref_list():
diff --git a/gramps/gui/editors/editldsord.py b/gramps/gui/editors/editldsord.py
index 55cdc93e6..17c158095 100644
--- a/gramps/gui/editors/editldsord.py
+++ b/gramps/gui/editors/editldsord.py
@@ -45,7 +45,7 @@ from gi.repository import Gtk
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import LdsOrd, NoteType
from gen.display.name import displayer as name_displayer
from gen.utils.lds import TEMPLES
from gui.glade import Glade
@@ -57,65 +57,65 @@ from gui.widgets import (PrivacyButton, MonitoredDate,
from gui.selectors import SelectorFactory
_DATA_MAP = {
- gen.lib.LdsOrd.BAPTISM : [
- gen.lib.LdsOrd.STATUS_NONE,
- gen.lib.LdsOrd.STATUS_CHILD,
- gen.lib.LdsOrd.STATUS_CLEARED,
- gen.lib.LdsOrd.STATUS_COMPLETED,
- gen.lib.LdsOrd.STATUS_INFANT,
- gen.lib.LdsOrd.STATUS_PRE_1970,
- gen.lib.LdsOrd.STATUS_QUALIFIED,
- gen.lib.LdsOrd.STATUS_STILLBORN,
- gen.lib.LdsOrd.STATUS_SUBMITTED,
- gen.lib.LdsOrd.STATUS_UNCLEARED,
+ LdsOrd.BAPTISM : [
+ LdsOrd.STATUS_NONE,
+ LdsOrd.STATUS_CHILD,
+ LdsOrd.STATUS_CLEARED,
+ LdsOrd.STATUS_COMPLETED,
+ LdsOrd.STATUS_INFANT,
+ LdsOrd.STATUS_PRE_1970,
+ LdsOrd.STATUS_QUALIFIED,
+ LdsOrd.STATUS_STILLBORN,
+ LdsOrd.STATUS_SUBMITTED,
+ LdsOrd.STATUS_UNCLEARED,
],
- gen.lib.LdsOrd.CONFIRMATION : [
- gen.lib.LdsOrd.STATUS_NONE,
- gen.lib.LdsOrd.STATUS_CHILD,
- gen.lib.LdsOrd.STATUS_CLEARED,
- gen.lib.LdsOrd.STATUS_COMPLETED,
- gen.lib.LdsOrd.STATUS_INFANT,
- gen.lib.LdsOrd.STATUS_PRE_1970,
- gen.lib.LdsOrd.STATUS_QUALIFIED,
- gen.lib.LdsOrd.STATUS_STILLBORN,
- gen.lib.LdsOrd.STATUS_SUBMITTED,
- gen.lib.LdsOrd.STATUS_UNCLEARED,
+ LdsOrd.CONFIRMATION : [
+ LdsOrd.STATUS_NONE,
+ LdsOrd.STATUS_CHILD,
+ LdsOrd.STATUS_CLEARED,
+ LdsOrd.STATUS_COMPLETED,
+ LdsOrd.STATUS_INFANT,
+ LdsOrd.STATUS_PRE_1970,
+ LdsOrd.STATUS_QUALIFIED,
+ LdsOrd.STATUS_STILLBORN,
+ LdsOrd.STATUS_SUBMITTED,
+ LdsOrd.STATUS_UNCLEARED,
],
- gen.lib.LdsOrd.ENDOWMENT: [
- gen.lib.LdsOrd.STATUS_NONE,
- gen.lib.LdsOrd.STATUS_CHILD,
- gen.lib.LdsOrd.STATUS_CLEARED,
- gen.lib.LdsOrd.STATUS_COMPLETED,
- gen.lib.LdsOrd.STATUS_INFANT,
- gen.lib.LdsOrd.STATUS_PRE_1970,
- gen.lib.LdsOrd.STATUS_QUALIFIED,
- gen.lib.LdsOrd.STATUS_STILLBORN,
- gen.lib.LdsOrd.STATUS_SUBMITTED,
- gen.lib.LdsOrd.STATUS_UNCLEARED,
+ LdsOrd.ENDOWMENT: [
+ LdsOrd.STATUS_NONE,
+ LdsOrd.STATUS_CHILD,
+ LdsOrd.STATUS_CLEARED,
+ LdsOrd.STATUS_COMPLETED,
+ LdsOrd.STATUS_INFANT,
+ LdsOrd.STATUS_PRE_1970,
+ LdsOrd.STATUS_QUALIFIED,
+ LdsOrd.STATUS_STILLBORN,
+ LdsOrd.STATUS_SUBMITTED,
+ LdsOrd.STATUS_UNCLEARED,
],
- gen.lib.LdsOrd.SEAL_TO_PARENTS:[
- gen.lib.LdsOrd.STATUS_NONE,
- gen.lib.LdsOrd.STATUS_BIC,
- gen.lib.LdsOrd.STATUS_CLEARED,
- gen.lib.LdsOrd.STATUS_COMPLETED,
- gen.lib.LdsOrd.STATUS_DNS,
- gen.lib.LdsOrd.STATUS_PRE_1970,
- gen.lib.LdsOrd.STATUS_QUALIFIED,
- gen.lib.LdsOrd.STATUS_STILLBORN,
- gen.lib.LdsOrd.STATUS_SUBMITTED,
- gen.lib.LdsOrd.STATUS_UNCLEARED,
+ LdsOrd.SEAL_TO_PARENTS:[
+ LdsOrd.STATUS_NONE,
+ LdsOrd.STATUS_BIC,
+ LdsOrd.STATUS_CLEARED,
+ LdsOrd.STATUS_COMPLETED,
+ LdsOrd.STATUS_DNS,
+ LdsOrd.STATUS_PRE_1970,
+ LdsOrd.STATUS_QUALIFIED,
+ LdsOrd.STATUS_STILLBORN,
+ LdsOrd.STATUS_SUBMITTED,
+ LdsOrd.STATUS_UNCLEARED,
],
- gen.lib.LdsOrd.SEAL_TO_SPOUSE :[
- gen.lib.LdsOrd.STATUS_NONE,
- gen.lib.LdsOrd.STATUS_CANCELED,
- gen.lib.LdsOrd.STATUS_CLEARED,
- gen.lib.LdsOrd.STATUS_COMPLETED,
- gen.lib.LdsOrd.STATUS_DNS,
- gen.lib.LdsOrd.STATUS_PRE_1970,
- gen.lib.LdsOrd.STATUS_QUALIFIED,
- gen.lib.LdsOrd.STATUS_DNS_CAN,
- gen.lib.LdsOrd.STATUS_SUBMITTED,
- gen.lib.LdsOrd.STATUS_UNCLEARED,
+ LdsOrd.SEAL_TO_SPOUSE :[
+ LdsOrd.STATUS_NONE,
+ LdsOrd.STATUS_CANCELED,
+ LdsOrd.STATUS_CLEARED,
+ LdsOrd.STATUS_COMPLETED,
+ LdsOrd.STATUS_DNS,
+ LdsOrd.STATUS_PRE_1970,
+ LdsOrd.STATUS_QUALIFIED,
+ LdsOrd.STATUS_DNS_CAN,
+ LdsOrd.STATUS_SUBMITTED,
+ LdsOrd.STATUS_UNCLEARED,
],
}
@@ -158,10 +158,10 @@ class EditLdsOrd(EditSecondary):
self.define_ok_button(self.top.get_object('ok'),self.save)
def _get_types(self):
- return (gen.lib.LdsOrd.BAPTISM,
- gen.lib.LdsOrd.ENDOWMENT,
- gen.lib.LdsOrd.CONFIRMATION,
- gen.lib.LdsOrd.SEAL_TO_PARENTS)
+ return (LdsOrd.BAPTISM,
+ LdsOrd.ENDOWMENT,
+ LdsOrd.CONFIRMATION,
+ LdsOrd.SEAL_TO_PARENTS)
def _setup_fields(self):
@@ -195,7 +195,7 @@ class EditLdsOrd(EditSecondary):
self.top.get_object('type'),
self.obj.set_type,
self.obj.get_type,
- [(item[1],item[0]) for item in gen.lib.LdsOrd._TYPE_MAP
+ [(item[1],item[0]) for item in LdsOrd._TYPE_MAP
if item[0] in self._get_types()],
self.db.readonly,
changed=self.ord_type_changed)
@@ -213,7 +213,7 @@ class EditLdsOrd(EditSecondary):
self.top.get_object('status'),
self.obj.set_status,
self.obj.get_status,
- [(item[1],item[0]) for item in gen.lib.LdsOrd._STATUS_MAP
+ [(item[1],item[0]) for item in LdsOrd._STATUS_MAP
if item[0] in _DATA_MAP[self.obj.get_type()] ],
self.db.readonly)
self.track_ref_for_deletion('status_menu')
@@ -222,19 +222,19 @@ class EditLdsOrd(EditSecondary):
self.update_parent_label()
def ord_type_changed(self):
- if self.obj.get_type() == gen.lib.LdsOrd.BAPTISM:
+ if self.obj.get_type() == LdsOrd.BAPTISM:
self.parents.hide()
self.parents_label.hide()
self.parents_select.hide()
- elif self.obj.get_type() == gen.lib.LdsOrd.ENDOWMENT:
+ elif self.obj.get_type() == LdsOrd.ENDOWMENT:
self.parents.hide()
self.parents_label.hide()
self.parents_select.hide()
- elif self.obj.get_type() == gen.lib.LdsOrd.SEAL_TO_PARENTS:
+ elif self.obj.get_type() == LdsOrd.SEAL_TO_PARENTS:
self.parents.show()
self.parents_label.show()
self.parents_select.show()
- new_data = [(item[1],item[0]) for item in gen.lib.LdsOrd._STATUS_MAP
+ new_data = [(item[1],item[0]) for item in LdsOrd._STATUS_MAP
if item[0] in _DATA_MAP[self.obj.get_type()] ]
self.status_menu.change_menu(new_data)
@@ -248,7 +248,7 @@ class EditLdsOrd(EditSecondary):
self.note_tab = NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(),
- notetype=gen.lib.NoteType.LDS)
+ notetype=NoteType.LDS)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
@@ -348,7 +348,7 @@ class EditFamilyLdsOrd(EditSecondary):
self.define_ok_button(self.top.get_object('ok'),self.save)
def _get_types(self):
- return (gen.lib.LdsOrd.SEAL_TO_SPOUSE,)
+ return (LdsOrd.SEAL_TO_SPOUSE,)
def _setup_fields(self):
@@ -382,7 +382,7 @@ class EditFamilyLdsOrd(EditSecondary):
self.top.get_object('type'),
self.obj.set_type,
self.obj.get_type,
- [(item[1],item[0]) for item in gen.lib.LdsOrd._TYPE_MAP
+ [(item[1],item[0]) for item in LdsOrd._TYPE_MAP
if item[0] in self._get_types()],
self.db.readonly)
self.track_ref_for_deletion('type_menu')
@@ -399,7 +399,7 @@ class EditFamilyLdsOrd(EditSecondary):
self.top.get_object('status'),
self.obj.set_status,
self.obj.get_status,
- [(item[1],item[0]) for item in gen.lib.LdsOrd._STATUS_MAP
+ [(item[1],item[0]) for item in LdsOrd._STATUS_MAP
if item[0] in _DATA_MAP[self.obj.get_type()]],
self.db.readonly)
self.track_ref_for_deletion('status_menu')
@@ -414,7 +414,7 @@ class EditFamilyLdsOrd(EditSecondary):
self.note_tab = NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(),
- notetype=gen.lib.NoteType.LDS)
+ notetype=NoteType.LDS)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
diff --git a/gramps/gui/editors/editmedia.py b/gramps/gui/editors/editmedia.py
index 79de8f6d1..07b24fff1 100644
--- a/gramps/gui/editors/editmedia.py
+++ b/gramps/gui/editors/editmedia.py
@@ -44,7 +44,7 @@ from gi.repository import Gdk
#
#-------------------------------------------------------------------------
from gui.utils import open_file_with_default_application
-import gen.lib
+from gramps.gen.lib import MediaObject, NoteType
from gen.db import DbTxn
import gen.mime
from gui.thumbnails import get_thumbnail_image, find_mime_type_pixbuf
@@ -77,7 +77,7 @@ class EditMedia(EditPrimary):
self._update_addmedia)
def empty_object(self):
- return gen.lib.MediaObject()
+ return MediaObject()
def get_menu_title(self):
if self.obj.get_handle():
@@ -213,7 +213,7 @@ class EditMedia(EditPrimary):
self.uistate,
self.track,
self.obj.get_note_list(),
- notetype=gen.lib.NoteType.MEDIA)
+ notetype=NoteType.MEDIA)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py
index 3492e1c46..9679ad5a4 100644
--- a/gramps/gui/editors/editperson.py
+++ b/gramps/gui/editors/editperson.py
@@ -54,7 +54,7 @@ from gen.utils.file import media_path_full
from gui.thumbnails import get_thumbnail_image
from gramps.gui.utils import is_right_click, open_file_with_default_application
from gen.utils.db import get_birth_or_fallback
-import gen.lib
+from gramps.gen.lib import NoteType, Person, Surname
from gen.db import DbTxn
from gui import widgets
from gen.display.name import displayer as name_displayer
@@ -140,9 +140,9 @@ class EditPerson(EditPrimary):
This is used by the base class (EditPrimary).
"""
- person = gen.lib.Person()
+ person = Person()
#the editor requires a surname
- person.primary_name.add_surname(gen.lib.Surname())
+ person.primary_name.add_surname(Surname())
person.primary_name.set_primary_surname(0)
return person
@@ -176,7 +176,7 @@ class EditPerson(EditPrimary):
self.pname = self.obj.get_primary_name()
self.should_guess_gender = (not self.obj.get_gramps_id() and
self.obj.get_gender () ==
- gen.lib.Person.UNKNOWN)
+ Person.UNKNOWN)
self.top = Glade()
@@ -324,9 +324,9 @@ class EditPerson(EditPrimary):
self.obj.set_gender,
self.obj.get_gender,
(
- (_('female'), gen.lib.Person.FEMALE),
- (_('male'), gen.lib.Person.MALE),
- (_('unknown'), gen.lib.Person.UNKNOWN)
+ (_('female'), Person.FEMALE),
+ (_('male'), Person.MALE),
+ (_('unknown'), Person.UNKNOWN)
),
self.db.readonly)
@@ -484,7 +484,7 @@ class EditPerson(EditPrimary):
self.track,
self.obj.get_note_list(),
self.get_menu_title(),
- notetype=gen.lib.NoteType.PERSON)
+ notetype=NoteType.PERSON)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
@@ -717,7 +717,7 @@ class EditPerson(EditPrimary):
return False
def _check_for_unknown_gender(self):
- if self.obj.get_gender() == gen.lib.Person.UNKNOWN:
+ if self.obj.get_gender() == Person.UNKNOWN:
d = GenderDialog(self.window)
gender = d.run()
d.destroy()
@@ -744,7 +744,7 @@ class EditPerson(EditPrimary):
if original:
(female, male, unknown) = _select_gender[self.obj.get_gender()]
- if male and original.get_gender() != gen.lib.Person.MALE:
+ if male and original.get_gender() != Person.MALE:
for tmp_handle in self.obj.get_family_handle_list():
temp_family = self.db.get_family_from_handle(tmp_handle)
if self.obj == temp_family.get_mother_handle():
@@ -753,7 +753,7 @@ class EditPerson(EditPrimary):
else:
temp_family.set_mother_handle(None)
temp_family.set_father_handle(self.obj)
- elif female and original != gen.lib.Person.FEMALE:
+ elif female and original != Person.FEMALE:
for tmp_handle in self.obj.get_family_handle_list():
temp_family = self.db.get_family_from_handle(tmp_handle)
if self.obj == temp_family.get_father_handle():
@@ -762,7 +762,7 @@ class EditPerson(EditPrimary):
else:
temp_family.set_father_handle(None)
temp_family.set_mother_handle(self.obj)
- elif unknown and original.get_gender() != gen.lib.Person.UNKNOWN:
+ elif unknown and original.get_gender() != Person.UNKNOWN:
for tmp_handle in self.obj.get_family_handle_list():
temp_family = self.db.get_family_from_handle(tmp_handle)
if self.obj == temp_family.get_father_handle():
@@ -803,7 +803,7 @@ class EditPerson(EditPrimary):
if len(newlist) != len(name.get_surname_list()):
name.set_surname_list(newlist)
if len(name.get_surname_list()) == 0:
- name.set_surname_list([gen.lib.Surname()])
+ name.set_surname_list([Surname()])
try:
primind = [surn.get_primary() for surn in name.get_surname_list()].index(True)
except ValueError:
@@ -1071,6 +1071,6 @@ class GenderDialog(Gtk.MessageDialog):
_("The gender of the person is currently unknown. "
"Usually, this is a mistake. Please specify the gender."))
- self.add_button(_('_Male'), gen.lib.Person.MALE)
- self.add_button(_('_Female'), gen.lib.Person.FEMALE)
- self.add_button(_('_Unknown'), gen.lib.Person.UNKNOWN)
+ self.add_button(_('_Male'), Person.MALE)
+ self.add_button(_('_Female'), Person.FEMALE)
+ self.add_button(_('_Unknown'), Person.UNKNOWN)
diff --git a/gramps/gui/editors/editplace.py b/gramps/gui/editors/editplace.py
index 0ffce7fa8..35221ffcc 100644
--- a/gramps/gui/editors/editplace.py
+++ b/gramps/gui/editors/editplace.py
@@ -44,7 +44,7 @@ from gi.repository import Gtk
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import NoteType, Place
from gen.db import DbTxn
from editprimary import EditPrimary
from displaytabs import (GrampsTab, LocationEmbedList, CitationEmbedList,
@@ -111,7 +111,7 @@ class EditPlace(EditPrimary):
dbstate.db.get_place_from_gramps_id, callback)
def empty_object(self):
- return gen.lib.Place()
+ return Place()
def _local_init(self):
self.width_key = 'interface.place-width'
@@ -258,7 +258,7 @@ class EditPlace(EditPrimary):
self.track,
self.obj.get_note_list(),
self.get_menu_title(),
- notetype=gen.lib.NoteType.PLACE)
+ notetype=NoteType.PLACE)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
diff --git a/gramps/gui/editors/editprimary.py b/gramps/gui/editors/editprimary.py
index 905b6099b..fb903fa01 100644
--- a/gramps/gui/editors/editprimary.py
+++ b/gramps/gui/editors/editprimary.py
@@ -47,7 +47,7 @@ from gen.config import config
from gramps.gui.utils import is_right_click
from gui.display import display_help
from gui.dialog import SaveDialog
-import gen.lib
+from gramps.gen.lib import PrimaryObject
from gui.dbguielement import DbGUIElement
class EditPrimary(ManagedWindow, DbGUIElement):
@@ -247,7 +247,7 @@ class EditPrimary(ManagedWindow, DbGUIElement):
#exception if it is not because self.empty_object().serialize() is
#called and PrimaryObject does not implement serialize(). See
#BaseObject.serialize()
- return gen.lib.PrimaryObject
+ return PrimaryObject
def data_has_changed(self):
if self.db.readonly:
diff --git a/gramps/gui/editors/editrepository.py b/gramps/gui/editors/editrepository.py
index 226f5b788..40d98c021 100644
--- a/gramps/gui/editors/editrepository.py
+++ b/gramps/gui/editors/editrepository.py
@@ -40,7 +40,7 @@ from gi.repository import Gtk
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import NoteType, Repository
from gen.db import DbTxn
from gui.widgets import MonitoredEntry, MonitoredDataType, PrivacyButton
@@ -58,7 +58,7 @@ class EditRepository(EditPrimary):
dbstate.db.get_repository_from_gramps_id)
def empty_object(self):
- return gen.lib.Repository()
+ return Repository()
def get_menu_title(self):
if self.obj.get_handle():
@@ -126,7 +126,7 @@ class EditRepository(EditPrimary):
self.track,
self.obj.get_note_list(),
self.get_menu_title(),
- notetype=gen.lib.NoteType.REPO)
+ notetype=NoteType.REPO)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
diff --git a/gramps/gui/editors/editsource.py b/gramps/gui/editors/editsource.py
index 2a124fcaa..ab9aa22c6 100644
--- a/gramps/gui/editors/editsource.py
+++ b/gramps/gui/editors/editsource.py
@@ -44,7 +44,7 @@ from gi.repository import Gtk
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import NoteType, Source
from gen.db import DbTxn
from editprimary import EditPrimary
@@ -69,7 +69,7 @@ class EditSource(EditPrimary):
dbstate.db.get_source_from_gramps_id)
def empty_object(self):
- return gen.lib.Source()
+ return Source()
def get_menu_title(self):
title = self.obj.get_title()
@@ -135,7 +135,7 @@ class EditSource(EditPrimary):
self.track,
self.obj.get_note_list(),
self.get_menu_title(),
- gen.lib.NoteType.SOURCE)
+ NoteType.SOURCE)
self._add_tab(notebook, self.note_tab)
self.track_ref_for_deletion("note_tab")
diff --git a/gramps/gui/editors/filtereditor.py b/gramps/gui/editors/filtereditor.py
index b030795c3..0544323d1 100644
--- a/gramps/gui/editors/filtereditor.py
+++ b/gramps/gui/editors/filtereditor.py
@@ -64,7 +64,7 @@ from gen.const import RULE_GLADE, URL_MANUAL_PAGE
from gui.display import display_help
from gen.errors import WindowActiveError
from gen.ggettext import sgettext as _
-import gen.lib
+from gramps.gen.lib import AttributeType, EventType, FamilyRelType, NameOriginType, NameType, NoteType
from gen.filters import rules
from gui.autocomp import StandardCustomSelector, fill_entry
from gui.selectors import SelectorFactory
@@ -93,17 +93,17 @@ _TITLES = {
}
_name2typeclass = {
- _('Personal event:') : gen.lib.EventType,
- _('Family event:') : gen.lib.EventType,
- _('Event type:') : gen.lib.EventType,
- _('Personal attribute:') : gen.lib.AttributeType,
- _('Family attribute:') : gen.lib.AttributeType,
- _('Event attribute:') : gen.lib.AttributeType,
- _('Media attribute:') : gen.lib.AttributeType,
- _('Relationship type:') : gen.lib.FamilyRelType,
- _('Note type:') : gen.lib.NoteType,
- _('Name type:') : gen.lib.NameType,
- _('Surname origin type:'): gen.lib.NameOriginType,
+ _('Personal event:') : EventType,
+ _('Family event:') : EventType,
+ _('Event type:') : EventType,
+ _('Personal attribute:') : AttributeType,
+ _('Family attribute:') : AttributeType,
+ _('Event attribute:') : AttributeType,
+ _('Media attribute:') : AttributeType,
+ _('Relationship type:') : FamilyRelType,
+ _('Note type:') : NoteType,
+ _('Name type:') : NameType,
+ _('Surname origin type:'): NameOriginType,
}
#-------------------------------------------------------------------------
diff --git a/gramps/gui/filters/sidebar/_citationsidebarfilter.py b/gramps/gui/filters/sidebar/_citationsidebarfilter.py
index 4166ea9dc..20caa5ffa 100644
--- a/gramps/gui/filters/sidebar/_citationsidebarfilter.py
+++ b/gramps/gui/filters/sidebar/_citationsidebarfilter.py
@@ -41,7 +41,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gui.widgets import MonitoredMenu
-import gen.lib
+from gramps.gen.lib import Citation
from gui.filters import build_filter_model
from gui.filters.sidebar import SidebarFilter
from gen.filters import GenericFilterFactory, rules
@@ -68,7 +68,7 @@ class CitationSidebarFilter(SidebarFilter):
for conf_value in sorted(confidence.keys()):
model.append((confidence[conf_value],))
self.filter_conf.set_model(model)
- self.filter_conf.set_active(2) # gen.lib.Citation.CONF_NORMAL
+ self.filter_conf.set_active(2) # Citation.CONF_NORMAL
self.filter_note = Gtk.Entry()
diff --git a/gramps/gui/filters/sidebar/_eventsidebarfilter.py b/gramps/gui/filters/sidebar/_eventsidebarfilter.py
index 8a2e1221d..88108b292 100644
--- a/gramps/gui/filters/sidebar/_eventsidebarfilter.py
+++ b/gramps/gui/filters/sidebar/_eventsidebarfilter.py
@@ -40,7 +40,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gui import widgets
-import gen.lib
+from gramps.gen.lib import Event, EventType
from gui.filters import build_filter_model
from gui.filters.sidebar import SidebarFilter
from gen.filters import GenericFilterFactory, rules
@@ -60,8 +60,8 @@ class EventSidebarFilter(SidebarFilter):
self.clicked_func = clicked
self.filter_id = widgets.BasicEntry()
self.filter_desc = widgets.BasicEntry()
- self.filter_event = gen.lib.Event()
- self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
+ self.filter_event = Event()
+ self.filter_event.set_type((EventType.CUSTOM, u''))
self.etype = Gtk.ComboBox(has_entry=True)
self.event_menu = widgets.MonitoredDataType(
diff --git a/gramps/gui/filters/sidebar/_familysidebarfilter.py b/gramps/gui/filters/sidebar/_familysidebarfilter.py
index 48385aa92..fcf4ec02f 100644
--- a/gramps/gui/filters/sidebar/_familysidebarfilter.py
+++ b/gramps/gui/filters/sidebar/_familysidebarfilter.py
@@ -41,7 +41,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gui import widgets
-import gen.lib
+from gramps.gen.lib import Event, EventType, Family, FamilyRelType
from gui.filters import build_filter_model
from gui.filters.sidebar import SidebarFilter
from gen.filters import GenericFilterFactory, rules
@@ -67,12 +67,12 @@ class FamilySidebarFilter(SidebarFilter):
self.filter_mother = widgets.BasicEntry()
self.filter_child = widgets.BasicEntry()
- self.filter_event = gen.lib.Event()
- self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
+ self.filter_event = Event()
+ self.filter_event.set_type((EventType.CUSTOM, u''))
self.etype = Gtk.ComboBox(has_entry=True)
- self.family_stub = gen.lib.Family()
- self.family_stub.set_relationship((gen.lib.FamilyRelType.CUSTOM, u''))
+ self.family_stub = Family()
+ self.family_stub.set_relationship((FamilyRelType.CUSTOM, u''))
self.rtype = Gtk.ComboBox(has_entry=True)
self.event_menu = widgets.MonitoredDataType(
diff --git a/gramps/gui/filters/sidebar/_personsidebarfilter.py b/gramps/gui/filters/sidebar/_personsidebarfilter.py
index 74e70998e..da803ed6e 100644
--- a/gramps/gui/filters/sidebar/_personsidebarfilter.py
+++ b/gramps/gui/filters/sidebar/_personsidebarfilter.py
@@ -42,7 +42,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gui import widgets
-import gen.lib
+from gramps.gen.lib import Date, Event, EventType
from gramps.gen.datehandler import displayer
from gui.filters import build_filter_model
from gui.filters.sidebar import SidebarFilter
@@ -77,8 +77,8 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_id = widgets.BasicEntry()
self.filter_birth = widgets.BasicEntry()
self.filter_death = widgets.BasicEntry()
- self.filter_event = gen.lib.Event()
- self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
+ self.filter_event = Event()
+ self.filter_event.set_type((EventType.CUSTOM, u''))
self.etype = Gtk.ComboBox(has_entry=True)
self.event_menu = widgets.MonitoredDataType(
self.etype,
@@ -114,13 +114,13 @@ class PersonSidebarFilter(SidebarFilter):
self.etype.get_child().set_width_chars(5)
- exdate1 = gen.lib.Date()
- exdate2 = gen.lib.Date()
- exdate1.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_RANGE,
- gen.lib.Date.CAL_GREGORIAN, (0, 0, 1800, False,
+ exdate1 = Date()
+ exdate2 = Date()
+ exdate1.set(Date.QUAL_NONE, Date.MOD_RANGE,
+ Date.CAL_GREGORIAN, (0, 0, 1800, False,
0, 0, 1900, False))
- exdate2.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_BEFORE,
- gen.lib.Date.CAL_GREGORIAN, (0, 0, 1850, False))
+ exdate2.set(Date.QUAL_NONE, Date.MOD_BEFORE,
+ Date.CAL_GREGORIAN, (0, 0, 1850, False))
msg1 = displayer.display(exdate1)
msg2 = displayer.display(exdate2)
diff --git a/gramps/gui/views/treemodels/citationbasemodel.py b/gramps/gui/views/treemodels/citationbasemodel.py
index 04ca58b16..2e58fa062 100644
--- a/gramps/gui/views/treemodels/citationbasemodel.py
+++ b/gramps/gui/views/treemodels/citationbasemodel.py
@@ -40,7 +40,7 @@ LOG = logging.getLogger(".citation")
#
#-------------------------------------------------------------------------
from gramps.gen.datehandler import format_time, get_date, get_date_valid
-import gen.lib
+from gramps.gen.lib import Citation
from gen.utils.string import confidence
from gen.config import config
@@ -81,7 +81,7 @@ class CitationBaseModel(object):
def citation_date(self, data):
if data[COLUMN_DATE]:
- citation = gen.lib.Citation()
+ citation = Citation()
citation.unserialize(data)
date_str = get_date(citation)
if date_str != "":
@@ -94,7 +94,7 @@ class CitationBaseModel(object):
def citation_sort_date(self, data):
if data[COLUMN_DATE]:
- citation = gen.lib.Citation()
+ citation = Citation()
citation.unserialize(data)
retval = "%09d" % citation.get_date_object().get_sort_value()
if not get_date_valid(citation):
diff --git a/gramps/gui/views/treemodels/eventmodel.py b/gramps/gui/views/treemodels/eventmodel.py
index 1583577c6..afd878941 100644
--- a/gramps/gui/views/treemodels/eventmodel.py
+++ b/gramps/gui/views/treemodels/eventmodel.py
@@ -41,7 +41,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gramps.gen.datehandler import format_time, get_date, get_date_valid
-import gen.lib
+from gramps.gen.lib import Event, EventType
from gen.utils.db import get_participant_from_event
from gen.config import config
from gui.views.treemodels.flatbasemodel import FlatBaseModel
@@ -125,14 +125,14 @@ class EventModel(FlatBaseModel):
return u''
def column_type(self,data):
- return unicode(gen.lib.EventType(data[COLUMN_TYPE]))
+ return unicode(EventType(data[COLUMN_TYPE]))
def column_id(self,data):
return unicode(data[COLUMN_ID])
def column_date(self,data):
if data[COLUMN_DATE]:
- event = gen.lib.Event()
+ event = Event()
event.unserialize(data)
date_str = get_date(event)
if date_str != "":
@@ -145,7 +145,7 @@ class EventModel(FlatBaseModel):
def sort_date(self,data):
if data[COLUMN_DATE]:
- event = gen.lib.Event()
+ event = Event()
event.unserialize(data)
retval = "%09d" % event.get_date_object().get_sort_value()
if not get_date_valid(event):
diff --git a/gramps/gui/views/treemodels/mediamodel.py b/gramps/gui/views/treemodels/mediamodel.py
index 77f3d5afc..04daba9e8 100644
--- a/gramps/gui/views/treemodels/mediamodel.py
+++ b/gramps/gui/views/treemodels/mediamodel.py
@@ -43,7 +43,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gramps.gen.datehandler import displayer, format_time
-import gen.lib
+from gramps.gen.lib import Date, MediaObject
from gui.views.treemodels.flatbasemodel import FlatBaseModel
#-------------------------------------------------------------------------
@@ -129,13 +129,13 @@ class MediaModel(FlatBaseModel):
def column_date(self,data):
if data[9]:
- date = gen.lib.Date()
+ date = Date()
date.unserialize(data[9])
return unicode(displayer.display(date))
return u''
def sort_date(self,data):
- obj = gen.lib.MediaObject()
+ obj = MediaObject()
obj.unserialize(data)
d = obj.get_date_object()
if d:
diff --git a/gramps/gui/views/treemodels/repomodel.py b/gramps/gui/views/treemodels/repomodel.py
index 7bc73403a..86d0cce29 100644
--- a/gramps/gui/views/treemodels/repomodel.py
+++ b/gramps/gui/views/treemodels/repomodel.py
@@ -39,7 +39,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Address, RepositoryType, Url, UrlType
from gramps.gen.datehandler import format_time
from gui.views.treemodels.flatbasemodel import FlatBaseModel
@@ -115,7 +115,7 @@ class RepositoryModel(FlatBaseModel):
return unicode(data[1])
def column_type(self,data):
- return unicode(gen.lib.RepositoryType(data[2]))
+ return unicode(RepositoryType(data[2]))
def column_name(self,data):
return unicode(data[3])
@@ -123,7 +123,7 @@ class RepositoryModel(FlatBaseModel):
def column_city(self,data):
try:
if data[5]:
- addr = gen.lib.Address()
+ addr = Address()
addr.unserialize(data[5][0])
return addr.get_city()
else:
@@ -134,7 +134,7 @@ class RepositoryModel(FlatBaseModel):
def column_street(self,data):
try:
if data[5]:
- addr = gen.lib.Address()
+ addr = Address()
addr.unserialize(data[5][0])
return addr.get_street()
else:
@@ -145,7 +145,7 @@ class RepositoryModel(FlatBaseModel):
def column_locality(self,data):
try:
if data[5]:
- addr = gen.lib.Address()
+ addr = Address()
addr.unserialize(data[5][0])
return addr.get_locality()
else:
@@ -156,7 +156,7 @@ class RepositoryModel(FlatBaseModel):
def column_state(self,data):
try:
if data[5]:
- addr = gen.lib.Address()
+ addr = Address()
addr.unserialize(data[5][0])
return addr.get_state()
else:
@@ -167,7 +167,7 @@ class RepositoryModel(FlatBaseModel):
def column_country(self,data):
try:
if data[5]:
- addr = gen.lib.Address()
+ addr = Address()
addr.unserialize(data[5][0])
return addr.get_country()
else:
@@ -178,7 +178,7 @@ class RepositoryModel(FlatBaseModel):
def column_postal_code(self,data):
try:
if data[5]:
- addr = gen.lib.Address()
+ addr = Address()
addr.unserialize(data[5][0])
return addr.get_postal_code()
else:
@@ -189,7 +189,7 @@ class RepositoryModel(FlatBaseModel):
def column_phone(self,data):
try:
if data[5]:
- addr = gen.lib.Address()
+ addr = Address()
addr.unserialize(data[5][0])
return addr.get_phone()
else:
@@ -200,27 +200,27 @@ class RepositoryModel(FlatBaseModel):
def column_email(self,data):
if data[6]:
for i in data[6]:
- url = gen.lib.Url()
+ url = Url()
url.unserialize(i)
- if url.get_type() == gen.lib.UrlType.EMAIL:
+ if url.get_type() == UrlType.EMAIL:
return unicode(url.path)
return u''
def column_search_url(self,data):
if data[6]:
for i in data[6]:
- url = gen.lib.Url()
+ url = Url()
url.unserialize(i)
- if url.get_type() == gen.lib.UrlType.WEB_SEARCH:
+ if url.get_type() == UrlType.WEB_SEARCH:
return unicode(url.path)
return u''
def column_home_url(self,data):
if data[6]:
for i in data[6]:
- url = gen.lib.Url()
+ url = Url()
url.unserialize(i)
- if url.get_type() == gen.lib.UrlType.WEB_HOME:
+ if url.get_type() == UrlType.WEB_HOME:
return unicode(url.path)
return u""
diff --git a/gramps/gui/widgets/fanchart.py b/gramps/gui/widgets/fanchart.py
index 6f6200777..6ed8d59bb 100644
--- a/gramps/gui/widgets/fanchart.py
+++ b/gramps/gui/widgets/fanchart.py
@@ -58,7 +58,7 @@ from gen.display.name import displayer as name_displayer
from gen.errors import WindowActiveError
from gui.editors import EditPerson, EditFamily
from gui.widgets.reorderfam import Reorder
-import gen.lib
+from gramps.gen.lib import ChildRef, Family, Name, Person, Surname
from gramps.gui.utils import color_graph_box, hex_to_rgb, is_right_click
from gui.ddtargets import DdTargets
from gen.utils.alive import probably_alive
@@ -76,9 +76,9 @@ def gender_code(is_male):
Given boolean is_male (means position in FanChart) return code.
"""
if is_male:
- return gen.lib.Person.MALE
+ return Person.MALE
else:
- return gen.lib.Person.FEMALE
+ return Person.FEMALE
#-------------------------------------------------------------------------
#
@@ -447,7 +447,7 @@ class FanChartBaseWidget(Gtk.DrawingArea):
if self.background == BACKGROUND_GRAD_GEN and generation < 0:
generation = 0
color = self.colors[generation % len(self.colors)]
- if person.gender == gen.lib.Person.MALE:
+ if person.gender == Person.MALE:
color = [x*.9 for x in color]
# now we set transparency data
if self.filter and not self.filter.match(person.handle, self.dbstate.db):
@@ -1132,9 +1132,9 @@ class FanChartWidget(FanChartBaseWidget):
family = self.dbstate.db.get_family_from_handle(family_id)
if family:
if father:
- person_handle = gen.lib.Family.get_father_handle(family)
+ person_handle = Family.get_father_handle(family)
else:
- person_handle = gen.lib.Family.get_mother_handle(family)
+ person_handle = Family.get_mother_handle(family)
if person_handle:
return self.dbstate.db.get_person_from_handle(person_handle)
return None
@@ -1858,9 +1858,9 @@ class FanChartGrampsGUI(object):
"""
Add a person
"""
- person = gen.lib.Person()
+ person = Person()
#the editor requires a surname
- person.primary_name.add_surname(gen.lib.Surname())
+ person.primary_name.add_surname(Surname())
person.primary_name.set_primary_surname(0)
try:
EditPerson(self.dbstate, self.uistate, [], person)
@@ -1869,10 +1869,10 @@ class FanChartGrampsGUI(object):
def add_child_to_fam_cb(self, obj, family_handle):
callback = lambda x: self.callback_add_child(x, family_handle)
- person = gen.lib.Person()
- name = gen.lib.Name()
+ person = Person()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
family = self.dbstate.db.get_family_from_handle(family_handle)
father = self.dbstate.db.get_person_from_handle(
@@ -1887,7 +1887,7 @@ class FanChartGrampsGUI(object):
pass
def callback_add_child(self, person, family_handle):
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = person.get_handle()
family = self.dbstate.db.get_family_from_handle(family_handle)
family.add_child_ref(ref)
@@ -1904,13 +1904,13 @@ class FanChartGrampsGUI(object):
"""
Add a family with the person preset
"""
- family = gen.lib.Family()
+ family = Family()
person = self.dbstate.db.get_person_from_handle(person_handle)
if not person:
return
- if person.gender == gen.lib.Person.MALE:
+ if person.gender == Person.MALE:
family.set_father_handle(person.handle)
else:
family.set_mother_handle(person.handle)
@@ -1921,8 +1921,8 @@ class FanChartGrampsGUI(object):
pass
def on_add_parents(self, obj, person_handle):
- family = gen.lib.Family()
- childref = gen.lib.ChildRef()
+ family = Family()
+ childref = ChildRef()
childref.set_reference_handle(person_handle)
family.add_child_ref(childref)
try:
diff --git a/gramps/plugins/drawreport/calendarreport.py b/gramps/plugins/drawreport/calendarreport.py
index 399b4361f..c4d71872a 100644
--- a/gramps/plugins/drawreport/calendarreport.py
+++ b/gramps/plugins/drawreport/calendarreport.py
@@ -52,7 +52,7 @@ from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
from gen.utils.alive import probably_alive
from gen.datehandler import displayer as _dd, long_days
-import gen.lib
+from gramps.gen.lib import Date, EventRoleType, EventType, Name, NameType, Person, Surname
import gramps.plugins.lib.libholiday as libholiday
from gramps.plugins.lib.libholiday import g2iso
@@ -107,20 +107,20 @@ class Calendar(Report):
married_name = None
names = [primary_name] + person.get_alternate_names()
for name in names:
- if int(name.get_type()) == gen.lib.NameType.MARRIED:
+ if int(name.get_type()) == NameType.MARRIED:
married_name = name
break # use first
# Now, decide which to use:
if maiden_name is not None:
if married_name is not None:
- name = gen.lib.Name(married_name)
+ name = Name(married_name)
else:
- name = gen.lib.Name(primary_name)
- surname = gen.lib.Surname()
+ name = Name(primary_name)
+ surname = Surname()
surname.set_surname(maiden_name)
name.set_surname_list([surname])
else:
- name = gen.lib.Name(primary_name)
+ name = Name(primary_name)
name.set_display_as(self.name_format)
return _nd.display_name(name)
@@ -293,13 +293,13 @@ class Calendar(Report):
month = birth_date.get_month()
day = birth_date.get_day()
- prob_alive_date = gen.lib.Date(self.year, month, day)
+ prob_alive_date = Date(self.year, month, day)
nyears = self.year - year
# add some things to handle maiden name:
father_lastname = None # husband, actually
if self.maiden_name in ['spouse_first', 'spouse_last']: # get husband's last name:
- if person.get_gender() == gen.lib.Person.FEMALE:
+ if person.get_gender() == Person.FEMALE:
family_list = person.get_family_handle_list()
if family_list:
if self.maiden_name == 'spouse_first':
@@ -351,8 +351,8 @@ class Calendar(Report):
are_married = None
for event_ref in fam.get_event_ref_list():
event = db.get_event_from_handle(event_ref.ref)
- et = gen.lib.EventType
- rt = gen.lib.EventRoleType
+ et = EventType
+ rt = EventRoleType
if event.type in [et.MARRIAGE,
et.MARR_ALT] and \
(event_ref.get_role() == rt.FAMILY or
@@ -374,7 +374,7 @@ class Calendar(Report):
month = event_obj.get_month()
day = event_obj.get_day()
- prob_alive_date = gen.lib.Date(self.year, month, day)
+ prob_alive_date = Date(self.year, month, day)
nyears = self.year - year
if nyears == 0:
diff --git a/gramps/plugins/drawreport/fanchart.py b/gramps/plugins/drawreport/fanchart.py
index 7fad85ee8..879443709 100644
--- a/gramps/plugins/drawreport/fanchart.py
+++ b/gramps/plugins/drawreport/fanchart.py
@@ -53,7 +53,7 @@ from gen.plug.report import utils
from gen.plug.report import MenuReportOptions
from gen.config import config
from gen.utils.db import get_birth_or_fallback, get_death_or_fallback
-import gen.lib
+from gramps.gen.lib import EventType
#------------------------------------------------------------------------
#
@@ -307,7 +307,7 @@ class FanChart(Report):
b = str(birth.get_date_object().to_calendar(self.calendar).get_year())
if b == 0:
b = ""
- elif birth.get_type() != gen.lib.EventType.BIRTH:
+ elif birth.get_type() != EventType.BIRTH:
b += '*'
death = get_death_or_fallback(self.database, person)
@@ -316,7 +316,7 @@ class FanChart(Report):
d = str(death.get_date_object().to_calendar(self.calendar).get_year())
if d == 0:
d = ""
- elif death.get_type() != gen.lib.EventType.DEATH:
+ elif death.get_type() != EventType.DEATH:
d += '*'
if b and d:
val = "%s - %s" % (str(b),str(d))
diff --git a/gramps/plugins/export/exportcsv.py b/gramps/plugins/export/exportcsv.py
index ab3f3a425..e3f49d637 100644
--- a/gramps/plugins/export/exportcsv.py
+++ b/gramps/plugins/export/exportcsv.py
@@ -49,7 +49,7 @@ LOG = logging.getLogger(".ExportCSV")
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventType, Person
from gen.lib.eventroletype import EventRoleType
from gui.plug.export import WriterOptionBox
from gen.utils.string import gender as gender_map
@@ -364,12 +364,12 @@ class CSVWriter(object):
note = '' # don't export notes
callname = primary_name.get_call_name()
gender = person.get_gender()
- if gender == gen.lib.Person.MALE:
- gender = gender_map[gen.lib.Person.MALE]
- elif gender == gen.lib.Person.FEMALE:
- gender = gender_map[gen.lib.Person.FEMALE]
+ if gender == Person.MALE:
+ gender = gender_map[Person.MALE]
+ elif gender == Person.FEMALE:
+ gender = gender_map[Person.FEMALE]
else:
- gender = gender_map[gen.lib.Person.UNKNOWN]
+ gender = gender_map[Person.UNKNOWN]
# Birth:
birthdate = ""
birthplace = ""
@@ -482,7 +482,7 @@ class CSVWriter(object):
event_ref_list = family.get_event_ref_list()
for event_ref in event_ref_list:
event = self.db.get_event_from_handle(event_ref.ref)
- if event.get_type() == gen.lib.EventType.MARRIAGE:
+ if event.get_type() == EventType.MARRIAGE:
mdate = self.format_date( event)
place_handle = event.get_place_handle()
if place_handle:
diff --git a/gramps/plugins/export/exportgedcom.py b/gramps/plugins/export/exportgedcom.py
index 584c1ff64..9e93b8dc8 100644
--- a/gramps/plugins/export/exportgedcom.py
+++ b/gramps/plugins/export/exportgedcom.py
@@ -42,7 +42,7 @@ import time
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import AttributeType, ChildRefType, Citation, Date, EventRoleType, EventType, LdsOrd, NameType, NoteType, Person, UrlType
from gen.const import VERSION
import gramps.plugins.lib.libgedcom as libgedcom
from gen.errors import DatabaseError
@@ -62,27 +62,27 @@ NEEDS_PARAMETER = set(
"NMR", "OCCU", "PROP", "RELI", "SSN", "TITL"])
LDS_ORD_NAME = {
- gen.lib.LdsOrd.BAPTISM : 'BAPL',
- gen.lib.LdsOrd.ENDOWMENT : 'ENDL',
- gen.lib.LdsOrd.SEAL_TO_PARENTS : 'SLGC',
- gen.lib.LdsOrd.SEAL_TO_SPOUSE : 'SLGS',
- gen.lib.LdsOrd.CONFIRMATION : 'CONL',
+ LdsOrd.BAPTISM : 'BAPL',
+ LdsOrd.ENDOWMENT : 'ENDL',
+ LdsOrd.SEAL_TO_PARENTS : 'SLGC',
+ LdsOrd.SEAL_TO_SPOUSE : 'SLGS',
+ LdsOrd.CONFIRMATION : 'CONL',
}
LDS_STATUS = {
- gen.lib.LdsOrd.STATUS_BIC : "BIC",
- gen.lib.LdsOrd.STATUS_CANCELED : "CANCELED",
- gen.lib.LdsOrd.STATUS_CHILD : "CHILD",
- gen.lib.LdsOrd.STATUS_CLEARED : "CLEARED",
- gen.lib.LdsOrd.STATUS_COMPLETED : "COMPLETED",
- gen.lib.LdsOrd.STATUS_DNS : "DNS",
- gen.lib.LdsOrd.STATUS_INFANT : "INFANT",
- gen.lib.LdsOrd.STATUS_PRE_1970 : "PRE-1970",
- gen.lib.LdsOrd.STATUS_QUALIFIED : "QUALIFIED",
- gen.lib.LdsOrd.STATUS_DNS_CAN : "DNS/CAN",
- gen.lib.LdsOrd.STATUS_STILLBORN : "STILLBORN",
- gen.lib.LdsOrd.STATUS_SUBMITTED : "SUBMITTED" ,
- gen.lib.LdsOrd.STATUS_UNCLEARED : "UNCLEARED",
+ LdsOrd.STATUS_BIC : "BIC",
+ LdsOrd.STATUS_CANCELED : "CANCELED",
+ LdsOrd.STATUS_CHILD : "CHILD",
+ LdsOrd.STATUS_CLEARED : "CLEARED",
+ LdsOrd.STATUS_COMPLETED : "COMPLETED",
+ LdsOrd.STATUS_DNS : "DNS",
+ LdsOrd.STATUS_INFANT : "INFANT",
+ LdsOrd.STATUS_PRE_1970 : "PRE-1970",
+ LdsOrd.STATUS_QUALIFIED : "QUALIFIED",
+ LdsOrd.STATUS_DNS_CAN : "DNS/CAN",
+ LdsOrd.STATUS_STILLBORN : "STILLBORN",
+ LdsOrd.STATUS_SUBMITTED : "SUBMITTED" ,
+ LdsOrd.STATUS_UNCLEARED : "UNCLEARED",
}
LANGUAGES = {
@@ -111,10 +111,10 @@ MIME2GED = {
}
QUALITY_MAP = {
- gen.lib.Citation.CONF_VERY_HIGH : "3",
- gen.lib.Citation.CONF_HIGH : "2",
- gen.lib.Citation.CONF_LOW : "1",
- gen.lib.Citation.CONF_VERY_LOW : "0",
+ Citation.CONF_VERY_HIGH : "3",
+ Citation.CONF_HIGH : "2",
+ Citation.CONF_LOW : "1",
+ Citation.CONF_VERY_LOW : "0",
}
#-------------------------------------------------------------------------
@@ -514,7 +514,7 @@ class GedcomWriter(UpdateCallback):
"""
nicknames = [ attr.get_value() for attr in person.get_attribute_list()
- if int(attr.get_type()) == gen.lib.AttributeType.NICKNAME ]
+ if int(attr.get_type()) == AttributeType.NICKNAME ]
if len(nicknames) > 0:
nickname = nicknames[0]
else:
@@ -533,9 +533,9 @@ class GedcomWriter(UpdateCallback):
unknown, we output nothing.
"""
- if person.get_gender() == gen.lib.Person.MALE:
+ if person.get_gender() == Person.MALE:
self._writeln(1, "SEX", "M")
- elif person.get_gender() == gen.lib.Person.FEMALE:
+ elif person.get_gender() == Person.FEMALE:
self._writeln(1, "SEX", "F")
def _lds_ords(self, obj, level):
@@ -568,13 +568,13 @@ class GedcomWriter(UpdateCallback):
"""
etype = int(event.get_type())
# if the event is a birth or death, skip it.
- if etype in (gen.lib.EventType.BIRTH, gen.lib.EventType.DEATH):
+ if etype in (EventType.BIRTH, EventType.DEATH):
return
role = int(event_ref.get_role())
# if the event role is not primary, skip the event.
- if role != gen.lib.EventRoleType.PRIMARY:
+ if role != EventRoleType.PRIMARY:
return
val = libgedcom.PERSONALCONSTANTEVENTS.get(etype, "").strip()
@@ -621,8 +621,8 @@ class GedcomWriter(UpdateCallback):
continue
for child_ref in [ ref for ref in family.get_child_ref_list()
if ref.ref == person.handle ]:
- if child_ref.mrel == gen.lib.ChildRefType.ADOPTED \
- or child_ref.frel == gen.lib.ChildRefType.ADOPTED:
+ if child_ref.mrel == ChildRefType.ADOPTED \
+ or child_ref.frel == ChildRefType.ADOPTED:
adoptions.append((family, child_ref.frel, child_ref.mrel))
for (fam, frel, mrel) in adoptions:
@@ -630,7 +630,7 @@ class GedcomWriter(UpdateCallback):
self._writeln(2, 'FAMC', '@%s@' % fam.get_gramps_id())
if mrel == frel:
self._writeln(3, 'ADOP', 'BOTH')
- elif mrel == gen.lib.ChildRefType.ADOPTED:
+ elif mrel == ChildRefType.ADOPTED:
self._writeln(3, 'ADOP', 'WIFE')
else:
self._writeln(3, 'ADOP', 'HUSB')
@@ -649,7 +649,7 @@ class GedcomWriter(UpdateCallback):
# filter out the nicknames
attr_list = [ attr for attr in person.get_attribute_list()
- if attr.get_type() != gen.lib.AttributeType.NICKNAME ]
+ if attr.get_type() != AttributeType.NICKNAME ]
for attr in attr_list:
@@ -871,7 +871,7 @@ class GedcomWriter(UpdateCallback):
else:
self._writeln(1, val, 'Y')
- if event.get_type() == gen.lib.EventType.MARRIAGE:
+ if event.get_type() == EventType.MARRIAGE:
self._family_event_attrs(event.get_attribute_list(), 2)
if event.get_description().strip() != "":
@@ -894,10 +894,10 @@ class GedcomWriter(UpdateCallback):
"""
for attr in attr_list:
- if attr.get_type() == gen.lib.AttributeType.FATHER_AGE:
+ if attr.get_type() == AttributeType.FATHER_AGE:
self._writeln(level, 'HUSB')
self._writeln(level+1, 'AGE', attr.get_value())
- elif attr.get_type() == gen.lib.AttributeType.MOTHER_AGE:
+ elif attr.get_type() == AttributeType.MOTHER_AGE:
self._writeln(level, 'WIFE')
self._writeln(level+1, 'AGE', attr.get_value())
@@ -1042,9 +1042,9 @@ class GedcomWriter(UpdateCallback):
if addr.get_phone():
self._writeln(1, 'PHON', addr.get_phone())
for url in repo.get_url_list():
- if int(url.get_type()) == gen.lib.UrlType.EMAIL:
+ if int(url.get_type()) == UrlType.EMAIL:
self._writeln(1, 'EMAIL', url.get_path())
- elif int(url.get_type()) == gen.lib.UrlType.WEB_HOME:
+ elif int(url.get_type()) == UrlType.WEB_HOME:
self._writeln(1, 'WWW', url.get_path())
self._note_references(repo.get_note_list(), 1)
@@ -1116,7 +1116,7 @@ class GedcomWriter(UpdateCallback):
if self._datewritten:
# write out TIME if present
times = [ attr.get_value() for attr in event.get_attribute_list()
- if int(attr.get_type()) == gen.lib.AttributeType.TIME ]
+ if int(attr.get_type()) == AttributeType.TIME ]
# Not legal, but inserted by PhpGedView
if len(times) > 0:
time = times[0]
@@ -1130,19 +1130,19 @@ class GedcomWriter(UpdateCallback):
for attr in event.get_attribute_list():
attr_type = attr.get_type()
- if attr_type == gen.lib.AttributeType.CAUSE:
+ if attr_type == AttributeType.CAUSE:
self._writeln(2, 'CAUS', attr.get_value())
- elif attr_type == gen.lib.AttributeType.AGENCY:
+ elif attr_type == AttributeType.AGENCY:
self._writeln(2, 'AGNC', attr.get_value())
for attr in event_ref.get_attribute_list():
attr_type = attr.get_type()
- if attr_type == gen.lib.AttributeType.AGE:
+ if attr_type == AttributeType.AGE:
self._writeln(2, 'AGE', attr.get_value())
- elif attr_type == gen.lib.AttributeType.FATHER_AGE:
+ elif attr_type == AttributeType.FATHER_AGE:
self._writeln(2, 'HUSB')
self._writeln(3, 'AGE', attr.get_value())
- elif attr_type == gen.lib.AttributeType.MOTHER_AGE:
+ elif attr_type == AttributeType.MOTHER_AGE:
self._writeln(2, 'WIFE')
self._writeln(3, 'AGE', attr.get_value())
@@ -1199,7 +1199,7 @@ class GedcomWriter(UpdateCallback):
if lds_ord.get_place_handle():
self._place(
self.dbase.get_place_from_handle(lds_ord.get_place_handle()), 2)
- if lds_ord.get_status() != gen.lib.LdsOrd.STATUS_NONE:
+ if lds_ord.get_status() != LdsOrd.STATUS_NONE:
self._writeln(2, 'STAT', LDS_STATUS[lds_ord.get_status()])
self._note_references(lds_ord.get_note_list(), index+1)
@@ -1212,16 +1212,16 @@ class GedcomWriter(UpdateCallback):
"""
self._datewritten = True
start = date.get_start_date()
- if start != gen.lib.Date.EMPTY:
+ if start != Date.EMPTY:
cal = date.get_calendar()
mod = date.get_modifier()
quality = date.get_quality()
- if mod == gen.lib.Date.MOD_SPAN:
+ if mod == Date.MOD_SPAN:
val = "FROM %s TO %s" % (
libgedcom.make_gedcom_date(start, cal, mod, quality),
libgedcom.make_gedcom_date(date.get_stop_date(),
cal, mod, quality))
- elif mod == gen.lib.Date.MOD_RANGE:
+ elif mod == Date.MOD_RANGE:
val = "BET %s AND %s" % (
libgedcom.make_gedcom_date(start, cal, mod, quality),
libgedcom.make_gedcom_date(date.get_stop_date(),
@@ -1266,11 +1266,11 @@ class GedcomWriter(UpdateCallback):
nick = attr_nick
self._writeln(1, 'NAME', gedcom_name)
- if int(name.get_type()) == gen.lib.NameType.BIRTH:
+ if int(name.get_type()) == NameType.BIRTH:
pass
- elif int(name.get_type()) == gen.lib.NameType.MARRIED:
+ elif int(name.get_type()) == NameType.MARRIED:
self._writeln(2, 'TYPE', 'married')
- elif int(name.get_type()) == gen.lib.NameType.AKA:
+ elif int(name.get_type()) == NameType.AKA:
self._writeln(2, 'TYPE', 'aka')
else:
self._writeln(2, 'TYPE', name.get_type().xml_str())
@@ -1327,8 +1327,8 @@ class GedcomWriter(UpdateCallback):
conf = min(citation.get_confidence_level(),
- gen.lib.Citation.CONF_VERY_HIGH)
- if conf != gen.lib.Citation.CONF_NORMAL and conf != -1:
+ Citation.CONF_VERY_HIGH)
+ if conf != Citation.CONF_NORMAL and conf != -1:
self._writeln(level+1, "QUAY", QUALITY_MAP[conf])
if not citation.get_date_object().is_empty():
@@ -1340,7 +1340,7 @@ class GedcomWriter(UpdateCallback):
note_list = [ self.dbase.get_note_from_handle(h)
for h in citation.get_note_list() ]
note_list = [ n for n in note_list
- if n.get_type() == gen.lib.NoteType.SOURCE_TEXT]
+ if n.get_type() == NoteType.SOURCE_TEXT]
if note_list:
ref_text = note_list[0].get()
@@ -1355,7 +1355,7 @@ class GedcomWriter(UpdateCallback):
note_list = [ self.dbase.get_note_from_handle(h)
for h in citation.get_note_list() ]
note_list = [ n.handle for n in note_list
- if n and n.get_type() != gen.lib.NoteType.SOURCE_TEXT]
+ if n and n.get_type() != NoteType.SOURCE_TEXT]
self._note_references(note_list, level+1)
self._photos(citation.get_media_list(), level+1)
diff --git a/gramps/plugins/export/exportgeneweb.py b/gramps/plugins/export/exportgeneweb.py
index bd666e2db..69c4f1b23 100644
--- a/gramps/plugins/export/exportgeneweb.py
+++ b/gramps/plugins/export/exportgeneweb.py
@@ -46,7 +46,7 @@ log = logging.getLogger(".WriteGeneWeb")
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Date, Event, EventType, FamilyRelType, Person
from gui.plug.export import WriterOptionBox
from gen.utils.alive import probably_alive
from gui.glade import Glade
@@ -156,18 +156,18 @@ class GeneWebWriter(object):
event_ref_list = family.get_event_ref_list()
for event_ref in event_ref:
event = self.db.get_event_from_handle(event_ref.ref)
- if event.type == gen.lib.EventType.MARRIAGE:
+ if event.type == EventType.MARRIAGE:
w_list = event.get_witness_list()
if w_list:
for witness in w_list:
- if witness and witness.type == gen.lib.Event.ID:
+ if witness and witness.type == Event.ID:
person = self.db.get_person_from_handle(
witness.get_value())
if person:
gender = ""
- if person.get_gender() == gen.lib.Person.MALE:
+ if person.get_gender() == Person.MALE:
gender = "h"
- elif person.get_gender() == gen.lib.Person.FEMALE:
+ elif person.get_gender() == Person.FEMALE:
gender = "f"
self.writeln("wit %s %s %s" %
(gender,
@@ -200,9 +200,9 @@ class GeneWebWriter(object):
child = self.db.get_person_from_handle(child_ref.ref)
if child:
gender = ""
- if child.get_gender() == gen.lib.Person.MALE:
+ if child.get_gender() == Person.MALE:
gender = "h"
- elif child.get_gender() == gen.lib.Person.FEMALE:
+ elif child.get_gender() == Person.FEMALE:
gender = "f"
self.writeln("- %s %s %s" %
(gender,
@@ -229,11 +229,11 @@ class GeneWebWriter(object):
## event_ref_list = family.get_event_ref_list()
## for event_ref in event_ref_list:
## event = self.db.get_event_from_handle(event_ref.ref)
-## if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
+## if int(event.get_type()) == EventType.MARRIAGE:
## w_list = event.get_witness_list()
## if w_list:
## for witness in w_list:
-## if witness and witness.type == gen.lib.Event.ID:
+## if witness and witness.type == Event.ID:
## person = self.db.get_person_from_handle(witness.get_value())
## if person:
## self.write_note_of_person(person)
@@ -369,7 +369,7 @@ class GeneWebWriter(object):
divorced = 0
for event_ref in event_ref_list:
event = self.db.get_event_from_handle(event_ref.ref)
- if event.get_type() == gen.lib.EventType.MARRIAGE:
+ if event.get_type() == EventType.MARRIAGE:
married = 1
m_date = self.format_date( event.get_date_object())
place_handle = event.get_place_handle()
@@ -377,7 +377,7 @@ class GeneWebWriter(object):
place = self.db.get_place_from_handle(place_handle)
m_place = place.get_title()
m_source = self.get_primary_source( event.get_citation_list())
- if event.get_type() == gen.lib.EventType.ENGAGEMENT:
+ if event.get_type() == EventType.ENGAGEMENT:
engaged = 1
eng_date = self.format_date( event.get_date_object())
place_handle = event.get_place_handle()
@@ -385,7 +385,7 @@ class GeneWebWriter(object):
place = self.db.get_place_from_handle(place_handle)
eng_place = place.get_title()
eng_source = self.get_primary_source( event.get_citation_list())
- if event.get_type() == gen.lib.EventType.DIVORCE:
+ if event.get_type() == EventType.DIVORCE:
divorced = 1
div_date = self.format_date( event.get_date_object())
if married == 1:
@@ -408,7 +408,7 @@ class GeneWebWriter(object):
if eng_source != "" and m_place == "":
ret = ret + " #ms %s" % self.rem_spaces( m_source)
else:
- if family.get_relationship() != gen.lib.FamilyRelType.MARRIED:
+ if family.get_relationship() != FamilyRelType.MARRIED:
"""Not married or engaged"""
ret = ret + " #nm"
@@ -438,19 +438,19 @@ class GeneWebWriter(object):
(day, month, year, sl) = subdate
cal_type = ""
- if cal == gen.lib.Date.CAL_HEBREW:
+ if cal == Date.CAL_HEBREW:
cal_type = "H"
- elif cal == gen.lib.Date.CAL_FRENCH:
+ elif cal == Date.CAL_FRENCH:
cal_type = "F"
- elif cal == gen.lib.Date.CAL_JULIAN:
+ elif cal == Date.CAL_JULIAN:
cal_type = "J"
mode_prefix = ""
- if mode == gen.lib.Date.MOD_ABOUT:
+ if mode == Date.MOD_ABOUT:
mode_prefix = "~"
- elif mode == gen.lib.Date.MOD_BEFORE:
+ elif mode == Date.MOD_BEFORE:
mode_prefix = "<"
- elif mode == gen.lib.Date.MOD_AFTER:
+ elif mode == Date.MOD_AFTER:
mode_prefix = ">"
if year > 0:
@@ -466,12 +466,12 @@ class GeneWebWriter(object):
def format_date(self,date):
retval = ""
- if date.get_modifier() == gen.lib.Date.MOD_TEXTONLY:
+ if date.get_modifier() == Date.MOD_TEXTONLY:
retval = "0(%s)" % self.rem_spaces(date.get_text())
elif not date.is_empty():
mod = date.get_modifier()
cal = cal = date.get_calendar()
- if mod == gen.lib.Date.MOD_SPAN or mod == gen.lib.Date.MOD_RANGE:
+ if mod == Date.MOD_SPAN or mod == Date.MOD_RANGE:
retval = "%s..%s" % (
self.format_single_date(date.get_start_date(), cal,mod),
self.format_single_date(date.get_stop_date(),cal,mod))
diff --git a/gramps/plugins/gramplet/agestats.py b/gramps/plugins/gramplet/agestats.py
index 711a50f36..642330838 100644
--- a/gramps/plugins/gramplet/agestats.py
+++ b/gramps/plugins/gramplet/agestats.py
@@ -29,7 +29,7 @@ from collections import defaultdict
from gen.plug import Gramplet
from gen.ggettext import gettext as _
-import gen.lib
+from gramps.gen.lib import ChildRefType
class AgeStatsGramplet(Gramplet):
@@ -125,11 +125,11 @@ class AgeStatsGramplet(Gramplet):
ref.get_father_relation()) for ref in
family.get_child_ref_list()
if ref.ref == p.handle] # get first, if more than one
- if childrel[0][0] == gen.lib.ChildRefType.BIRTH:
+ if childrel[0][0] == ChildRefType.BIRTH:
m_handle = family.get_mother_handle()
else:
m_handle = None
- if childrel[0][1] == gen.lib.ChildRefType.BIRTH:
+ if childrel[0][1] == ChildRefType.BIRTH:
f_handle = family.get_father_handle()
else:
f_handle = None
diff --git a/gramps/plugins/gramplet/calendargramplet.py b/gramps/plugins/gramplet/calendargramplet.py
index 6488e8420..594ed11e8 100644
--- a/gramps/plugins/gramplet/calendargramplet.py
+++ b/gramps/plugins/gramplet/calendargramplet.py
@@ -26,7 +26,7 @@
from gen.plug import Gramplet
from gen.ggettext import sgettext as _
from gui.plug.quick import run_quick_report_by_name
-import gen.lib
+from gramps.gen.lib import Date
#------------------------------------------------------------------------
#
@@ -51,7 +51,7 @@ class CalendarGramplet(Gramplet):
def double_click(self, obj):
# bring up events on this day
year, month, day = self.gui.calendar.get_date()
- date = gen.lib.Date()
+ date = Date()
date.set_yr_mon_day(year, month + 1, day)
run_quick_report_by_name(self.gui.dbstate,
self.gui.uistate,
diff --git a/gramps/plugins/graph/gvfamilylines.py b/gramps/plugins/graph/gvfamilylines.py
index 5316b695a..101e427b4 100644
--- a/gramps/plugins/graph/gvfamilylines.py
+++ b/gramps/plugins/graph/gvfamilylines.py
@@ -50,7 +50,7 @@ log = logging.getLogger(".FamilyLines")
# GRAMPS module
#
#------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventRoleType, EventType, Person
from gen.utils.file import media_path_full
from gui.thumbnails import get_thumbnail_path
from gen.datehandler import displayer as _dd
@@ -721,9 +721,9 @@ class FamilyLinesReport(Report):
# figure out what colour to use
gender = person.get_gender()
colour = self._colorunknown
- if gender == gen.lib.Person.MALE:
+ if gender == Person.MALE:
colour = self._colormales
- elif gender == gen.lib.Person.FEMALE:
+ elif gender == Person.FEMALE:
colour = self._colorfemales
# see if we have surname colours that match this person
@@ -887,9 +887,9 @@ class FamilyLinesReport(Report):
if self._incdates or self._incplaces:
for event_ref in family.get_event_ref_list():
event = self._db.get_event_from_handle(event_ref.ref)
- if event.get_type() == gen.lib.EventType.MARRIAGE and \
- (event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
- event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ):
+ if event.get_type() == EventType.MARRIAGE and \
+ (event_ref.get_role() == EventRoleType.FAMILY or
+ event_ref.get_role() == EventRoleType.PRIMARY ):
# get the wedding date
if (event.private and self._incprivate) or not event.private:
if self._incdates:
diff --git a/gramps/plugins/graph/gvrelgraph.py b/gramps/plugins/graph/gvrelgraph.py
index 84f20e1f8..1e63813a2 100644
--- a/gramps/plugins/graph/gvrelgraph.py
+++ b/gramps/plugins/graph/gvrelgraph.py
@@ -54,7 +54,7 @@ from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
from gen.display.name import displayer as name_displayer
from gramps.gen.datehandler import get_date
-import gen.lib
+from gramps.gen.lib import ChildRefType, EventRoleType, EventType
from gen.utils.file import media_path_full, find_file
from gui.thumbnails import get_thumbnail_path
from gen.utils.db import get_birth_or_fallback, get_death_or_fallback
@@ -201,12 +201,12 @@ class RelGraphReport(Report):
def add_family_link(self, p_id, family, frel, mrel):
"Links the child to a family"
style = 'solid'
- adopted = ((int(frel) != gen.lib.ChildRefType.BIRTH) or
- (int(mrel) != gen.lib.ChildRefType.BIRTH))
+ adopted = ((int(frel) != ChildRefType.BIRTH) or
+ (int(mrel) != ChildRefType.BIRTH))
# If birth relation to father is NONE, meaning there is no father and
# if birth relation to mother is BIRTH then solid line
- if ((int(frel) == gen.lib.ChildRefType.NONE) and
- (int(mrel) == gen.lib.ChildRefType.BIRTH)):
+ if ((int(frel) == ChildRefType.NONE) and
+ (int(mrel) == ChildRefType.BIRTH)):
adopted = False
if adopted and self.adoptionsdashed:
style = 'dotted'
@@ -216,7 +216,7 @@ class RelGraphReport(Report):
def add_parent_link(self, p_id, parent_handle, rel):
"Links the child to a parent"
style = 'solid'
- if (int(rel) != gen.lib.ChildRefType.BIRTH) and self.adoptionsdashed:
+ if (int(rel) != ChildRefType.BIRTH) and self.adoptionsdashed:
style = 'dotted'
parent = self.database.get_person_from_handle(parent_handle)
self.doc.add_link( parent.get_gramps_id(), p_id, style,
@@ -273,9 +273,9 @@ class RelGraphReport(Report):
label = ""
for event_ref in fam.get_event_ref_list():
event = self.database.get_event_from_handle(event_ref.ref)
- if event.type == gen.lib.EventType.MARRIAGE and \
- (event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
- event_ref.get_role() == gen.lib.EventRoleType.PRIMARY):
+ if event.type == EventType.MARRIAGE and \
+ (event_ref.get_role() == EventRoleType.FAMILY or
+ event_ref.get_role() == EventRoleType.PRIMARY):
label = self.get_event_string(event)
break
if self.includeid:
diff --git a/gramps/plugins/import/importcsv.py b/gramps/plugins/import/importcsv.py
index dd6cda2dd..a1b6d484a 100644
--- a/gramps/plugins/import/importcsv.py
+++ b/gramps/plugins/import/importcsv.py
@@ -49,7 +49,7 @@ LOG = logging.getLogger(".ImportCSV")
#-------------------------------------------------------------------------
from gen.ggettext import sgettext as _
from gen.ggettext import ngettext
-import gen.lib
+from gramps.gen.lib import ChildRef, Citation, Event, EventRef, EventType, Family, FamilyRelType, Name, NameType, Note, NoteType, Person, Place, Source, Surname
from gen.db import DbTxn
from gen.plug.utils import OpenFileOrStdin
from gen.datehandler import parser as _dp
@@ -380,13 +380,13 @@ class CSVParser(object):
# adjust gender, if not already provided
if husband:
# this is just a guess, if unknown
- if husband.get_gender() == gen.lib.Person.UNKNOWN:
- husband.set_gender(gen.lib.Person.MALE)
+ if husband.get_gender() == Person.UNKNOWN:
+ husband.set_gender(Person.MALE)
self.db.commit_person(husband, self.trans)
if wife:
# this is just a guess, if unknown
- if wife.get_gender() == gen.lib.Person.UNKNOWN:
- wife.set_gender(gen.lib.Person.FEMALE)
+ if wife.get_gender() == Person.UNKNOWN:
+ wife.set_gender(Person.FEMALE)
self.db.commit_person(wife, self.trans)
if marriage_ref:
self.storeup("family", marriage_ref.lower(), family)
@@ -401,10 +401,10 @@ class CSVParser(object):
if marriagedate or marriageplace or marriagesource or note:
# add, if new; replace, if different
new, marriage = self.get_or_create_event(family,
- gen.lib.EventType.MARRIAGE, marriagedate,
+ EventType.MARRIAGE, marriagedate,
marriageplace, marriagesource)
if new:
- mar_ref = gen.lib.EventRef()
+ mar_ref = EventRef()
mar_ref.set_reference_handle(marriage.get_handle())
family.add_event_ref(mar_ref)
self.db.commit_family(family, self.trans)
@@ -416,7 +416,7 @@ class CSVParser(object):
for note_handle in previous_notes_list:
previous_note = self.db.get_note_from_handle(
note_handle)
- if previous_note.type == gen.lib.NoteType.EVENT:
+ if previous_note.type == NoteType.EVENT:
previous_text = previous_note.get()
if note not in previous_text:
note = previous_text + "\n" + note
@@ -426,9 +426,9 @@ class CSVParser(object):
break
if not updated_note:
# add new note here
- new_note = gen.lib.Note()
+ new_note = Note()
new_note.handle = create_id()
- new_note.type.set(gen.lib.NoteType.EVENT)
+ new_note.type.set(NoteType.EVENT)
new_note.set(note)
self.db.add_note(new_note, self.trans)
marriage.add_note(new_note.handle)
@@ -464,7 +464,7 @@ class CSVParser(object):
# add child to family
LOG.debug(" adding child [%s] to family [%s]",
child.get_gramps_id(), family.get_gramps_id())
- childref = gen.lib.ChildRef()
+ childref = ChildRef()
childref.set_reference_handle(child.get_handle())
family.add_child_ref( childref)
self.db.commit_family(family, self.trans)
@@ -472,12 +472,12 @@ class CSVParser(object):
if gender:
# replace
gender = gender.lower()
- if gender == gender_map[gen.lib.Person.MALE].lower():
- gender = gen.lib.Person.MALE
- elif gender == gender_map[gen.lib.Person.FEMALE].lower():
- gender = gen.lib.Person.FEMALE
+ if gender == gender_map[Person.MALE].lower():
+ gender = Person.MALE
+ elif gender == gender_map[Person.FEMALE].lower():
+ gender = Person.FEMALE
else:
- gender = gen.lib.Person.UNKNOWN
+ gender = Person.UNKNOWN
child.set_gender(gender)
if source:
# add, if new
@@ -490,7 +490,7 @@ class CSVParser(object):
updated_note = False
for note_handle in previous_notes_list:
previous_note = self.db.get_note_from_handle(note_handle)
- if previous_note.type == gen.lib.NoteType.PERSON:
+ if previous_note.type == NoteType.PERSON:
previous_text = previous_note.get()
if note not in previous_text:
note = previous_text + "\n" + note
@@ -500,9 +500,9 @@ class CSVParser(object):
break
if not updated_note:
# add new note here
- new_note = gen.lib.Note()
+ new_note = Note()
new_note.handle = create_id()
- new_note.type.set(gen.lib.NoteType.PERSON)
+ new_note.type.set(NoteType.PERSON)
new_note.set(note)
self.db.add_note(new_note, self.trans)
child.add_note(new_note.handle)
@@ -544,10 +544,10 @@ class CSVParser(object):
surname = ""
# new person
person = self.create_person()
- name = gen.lib.Name()
- name.set_type(gen.lib.NameType(gen.lib.NameType.BIRTH))
+ name = Name()
+ name.set_type(NameType(NameType.BIRTH))
name.set_first_name(firstname)
- surname_obj = gen.lib.Surname()
+ surname_obj = Surname()
surname_obj.set_surname(surname)
name.add_surname(surname_obj)
person.set_primary_name(name)
@@ -576,7 +576,7 @@ class CSVParser(object):
updated_note = False
for note_handle in previous_notes_list:
previous_note = self.db.get_note_from_handle(note_handle)
- if previous_note.type == gen.lib.NoteType.PERSON:
+ if previous_note.type == NoteType.PERSON:
previous_text = previous_note.get()
if note not in previous_text:
note = previous_text + "\n" + note
@@ -586,9 +586,9 @@ class CSVParser(object):
break
if not updated_note:
# add new note here
- new_note = gen.lib.Note()
+ new_note = Note()
new_note.handle = create_id()
- new_note.type.set(gen.lib.NoteType.PERSON)
+ new_note.type.set(NoteType.PERSON)
new_note.set(note)
self.db.add_note(new_note, self.trans)
person.add_note(new_note.handle)
@@ -597,15 +597,15 @@ class CSVParser(object):
elif person_ref is not None:
if person_ref.startswith("[") and person_ref.endswith("]"):
person.gramps_id = self.db.id2user_format(person_ref[1:-1])
- if (person.get_gender() == gen.lib.Person.UNKNOWN and
+ if (person.get_gender() == Person.UNKNOWN and
gender is not None):
gender = gender.lower()
- if gender == gender_map[gen.lib.Person.MALE].lower():
- gender = gen.lib.Person.MALE
- elif gender == gender_map[gen.lib.Person.FEMALE].lower():
- gender = gen.lib.Person.FEMALE
+ if gender == gender_map[Person.MALE].lower():
+ gender = Person.MALE
+ elif gender == gender_map[Person.FEMALE].lower():
+ gender = Person.FEMALE
else:
- gender = gen.lib.Person.UNKNOWN
+ gender = Person.UNKNOWN
person.set_gender(gender)
#########################################################
# add if new, replace if different
@@ -618,12 +618,12 @@ class CSVParser(object):
new, birthsource = self.get_or_create_source(birthsource)
if birthdate or birthplace or birthsource:
new, birth = self.get_or_create_event(person,
- gen.lib.EventType.BIRTH, birthdate,
+ EventType.BIRTH, birthdate,
birthplace, birthsource)
birth_ref = person.get_birth_ref()
if birth_ref is None:
# new
- birth_ref = gen.lib.EventRef()
+ birth_ref = EventRef()
birth_ref.set_reference_handle( birth.get_handle())
person.set_birth_ref( birth_ref)
# Baptism:
@@ -635,13 +635,13 @@ class CSVParser(object):
new, baptismsource = self.get_or_create_source(baptismsource)
if baptismdate or baptismplace or baptismsource:
new, baptism = self.get_or_create_event(person,
- gen.lib.EventType.BAPTISM, baptismdate,
+ EventType.BAPTISM, baptismdate,
baptismplace, baptismsource)
baptism_ref = get_primary_event_ref_from_type(self.db, person,
"Baptism")
if baptism_ref is None:
# new
- baptism_ref = gen.lib.EventRef()
+ baptism_ref = EventRef()
baptism_ref.set_reference_handle( baptism.get_handle())
person.add_event_ref( baptism_ref)
# Death:
@@ -653,7 +653,7 @@ class CSVParser(object):
new, deathsource = self.get_or_create_source(deathsource)
if deathdate or deathplace or deathsource or deathcause:
new, death = self.get_or_create_event(person,
- gen.lib.EventType.DEATH, deathdate, deathplace,
+ EventType.DEATH, deathdate, deathplace,
deathsource)
if deathcause:
death.set_description(deathcause)
@@ -661,7 +661,7 @@ class CSVParser(object):
death_ref = person.get_death_ref()
if death_ref is None:
# new
- death_ref = gen.lib.EventRef()
+ death_ref = EventRef()
death_ref.set_reference_handle(death.get_handle())
person.set_death_ref(death_ref)
# Burial:
@@ -673,13 +673,13 @@ class CSVParser(object):
new, burialsource = self.get_or_create_source(burialsource)
if burialdate or burialplace or burialsource:
new, burial = self.get_or_create_event(person,
- gen.lib.EventType.BURIAL, burialdate,
+ EventType.BURIAL, burialdate,
burialplace, burialsource)
burial_ref = get_primary_event_ref_from_type(self.db, person,
"Burial")
if burial_ref is None:
# new
- burial_ref = gen.lib.EventRef()
+ burial_ref = EventRef()
burial_ref.set_reference_handle( burial.get_handle())
person.add_event_ref( burial_ref)
if source:
@@ -710,7 +710,7 @@ class CSVParser(object):
LOG.debug(" returning existing family")
return family
# if not, create one:
- family = gen.lib.Family()
+ family = Family()
# was marked with a gramps_id, but didn't exist, so we'll use it:
if family_ref.startswith("[") and family_ref.endswith("]"):
id_ = self.db.fid2user_format(family_ref[1:-1])
@@ -724,7 +724,7 @@ class CSVParser(object):
family.set_mother_handle(wife.get_handle())
wife.add_family_handle(family.get_handle())
if husband and wife:
- family.set_relationship(gen.lib.FamilyRelType.MARRIED)
+ family.set_relationship(FamilyRelType.MARRIED)
self.db.add_family(family, self.trans)
if husband:
self.db.commit_person(husband, self.trans)
@@ -758,9 +758,9 @@ class CSVParser(object):
return (0, event)
# else create it:
LOG.debug(" creating event")
- event = gen.lib.Event()
+ event = Event()
if type_:
- event.set_type(gen.lib.EventType(type_))
+ event.set_type(EventType(type_))
if date:
event.set_date_object(date)
if place:
@@ -772,7 +772,7 @@ class CSVParser(object):
def create_person(self):
""" Used to create a new person we know doesn't exist """
- person = gen.lib.Person()
+ person = Person()
self.db.add_person(person, self.trans)
self.indi_count += 1
return person
@@ -784,7 +784,7 @@ class CSVParser(object):
place = self.db.get_place_from_handle(place_handle)
if place.get_title() == place_name:
return (0, place)
- place = gen.lib.Place()
+ place = Place()
place.set_title(place_name)
self.db.add_place(place, self.trans)
return (1, place)
@@ -800,7 +800,7 @@ class CSVParser(object):
LOG.debug(" returning existing source")
return (0, source)
LOG.debug(" creating source")
- source = gen.lib.Source()
+ source = Source()
source.set_title(source_text)
self.db.add_source(source, self.trans)
return (1, source)
@@ -822,7 +822,7 @@ class CSVParser(object):
LOG.debug(" source already cited")
return
# we couldn't find an appropriate citation, so we have to create one.
- citation = gen.lib.Citation()
+ citation = Citation()
LOG.debug(" creating citation")
citation.set_reference_handle(source.get_handle())
self.db.add_citation(citation, self.trans)
diff --git a/gramps/plugins/import/importgeneweb.py b/gramps/plugins/import/importgeneweb.py
index ac61497c6..f036e56fd 100644
--- a/gramps/plugins/import/importgeneweb.py
+++ b/gramps/plugins/import/importgeneweb.py
@@ -47,7 +47,7 @@ LOG = logging.getLogger(".ImportGeneWeb")
#
#-------------------------------------------------------------------------
from gen.errors import GedcomError
-import gen.lib
+from gramps.gen.lib import Attribute, AttributeType, ChildRef, Citation, Date, Event, EventRef, EventRoleType, EventType, Family, FamilyRelType, Name, NameType, Note, Person, PersonRef, Place, Source
from gen.db import DbTxn
from htmlentitydefs import name2codepoint
@@ -55,15 +55,15 @@ _date_parse = re.compile('([kmes~?<>]+)?([0-9/]+)([J|H|F])?(\.\.)?([0-9/]+)?([J|
_text_parse = re.compile('0\((.*)\)')
_mod_map = {
- '>' : gen.lib.Date.MOD_AFTER,
- '<' : gen.lib.Date.MOD_BEFORE,
- '~' : gen.lib.Date.MOD_ABOUT,
+ '>' : Date.MOD_AFTER,
+ '<' : Date.MOD_BEFORE,
+ '~' : Date.MOD_ABOUT,
}
_cal_map = {
- 'J' : gen.lib.Date.CAL_JULIAN,
- 'H' : gen.lib.Date.CAL_HEBREW,
- 'F' : gen.lib.Date.CAL_FRENCH,
+ 'J' : Date.CAL_JULIAN,
+ 'H' : Date.CAL_HEBREW,
+ 'F' : Date.CAL_FRENCH,
}
#-------------------------------------------------------------------------
@@ -190,14 +190,14 @@ class GeneWebParser(object):
self.current_husband_handle = None
self.current_child_birthplace_handle = None
self.current_child_source_handle = None
- self.current_family = gen.lib.Family()
+ self.current_family = Family()
self.db.add_family(self.current_family,self.trans)
#self.db.commit_family(self.current_family,self.trans)
self.fkeys.append(self.current_family.get_handle())
idx = 1;
LOG.debug("\nHusband:")
- (idx, husband) = self.parse_person(fields,idx,gen.lib.Person.MALE,None)
+ (idx, husband) = self.parse_person(fields,idx,Person.MALE,None)
if husband:
self.current_husband_handle = husband.get_handle()
self.current_family.set_father_handle(husband.get_handle())
@@ -207,7 +207,7 @@ class GeneWebParser(object):
LOG.debug("Marriage:")
idx = self.parse_marriage(fields,idx)
LOG.debug("Wife:")
- (idx,wife) = self.parse_person(fields,idx,gen.lib.Person.FEMALE,None)
+ (idx,wife) = self.parse_person(fields,idx,Person.FEMALE,None)
if wife:
self.current_family.set_mother_handle(wife.get_handle())
self.db.commit_family(self.current_family,self.trans)
@@ -217,7 +217,7 @@ class GeneWebParser(object):
def read_relationship_person(self,line,fields):
LOG.debug("\Relationships:")
- (idx,person) = self.parse_person(fields,1,gen.lib.Person.UNKNOWN,None)
+ (idx,person) = self.parse_person(fields,1,Person.UNKNOWN,None)
if person:
self.current_relationship_person_handle = person.get_handle()
@@ -240,8 +240,8 @@ class GeneWebParser(object):
#split related person into fields
fields = matches.groups()[1].split(" ")
if fields:
- (idx,asso_p) = self.parse_person(fields,0,gen.lib.Person.UNKNOWN,None)
- pref = gen.lib.PersonRef()
+ (idx,asso_p) = self.parse_person(fields,0,Person.UNKNOWN,None)
+ pref = PersonRef()
pref.set_relation(matches.groups()[0])
LOG.warn("TODO: Handle association types properly")
pref.set_reference_handle(asso_p.get_handle())
@@ -267,9 +267,9 @@ class GeneWebParser(object):
def read_witness_line(self,line,fields):
LOG.debug("Witness:")
if fields[1] == "m:":
- (idx,wit_p) = self.parse_person(fields,2,gen.lib.Person.MALE,None)
+ (idx,wit_p) = self.parse_person(fields,2,Person.MALE,None)
elif fields[1] == "f:":
- (idx,wit_p) = self.parse_person(fields,2,gen.lib.Person.FEMALE,None)
+ (idx,wit_p) = self.parse_person(fields,2,Person.FEMALE,None)
else:
(idx,wit_p) = self.parse_person(fields,1,None,None)
if wit_p:
@@ -277,15 +277,15 @@ class GeneWebParser(object):
# search marriage event
for evr in self.current_family.get_event_ref_list():
ev = self.db.get_event_from_handle(evr.get_reference_handle())
- if ev.get_type() == gen.lib.EventType.MARRIAGE:
+ if ev.get_type() == EventType.MARRIAGE:
mev = ev # found.
if not mev: # No marriage event found create a new one
- mev = self.create_event(gen.lib.EventType.MARRIAGE, None, None, None, None)
- mar_ref = gen.lib.EventRef()
+ mev = self.create_event(EventType.MARRIAGE, None, None, None, None)
+ mar_ref = EventRef()
mar_ref.set_reference_handle(mev.get_handle())
self.current_family.add_event_ref(mar_ref)
- wit_ref = gen.lib.EventRef()
- wit_ref.set_role(gen.lib.EventRoleType(gen.lib.EventRoleType.WITNESS))
+ wit_ref = EventRef()
+ wit_ref.set_role(EventRoleType(EventRoleType.WITNESS))
wit_ref.set_reference_handle(mev.get_handle())
wit_p.add_event_ref(wit_ref)
self.db.commit_person(wit_p,self.trans)
@@ -313,14 +313,14 @@ class GeneWebParser(object):
LOG.debug("Child:")
child = None
if fields[1] == "h":
- (idx,child) = self.parse_person(fields,2,gen.lib.Person.MALE,father_surname)
+ (idx,child) = self.parse_person(fields,2,Person.MALE,father_surname)
elif fields[1] == "f":
- (idx,child) = self.parse_person(fields,2,gen.lib.Person.FEMALE,father_surname)
+ (idx,child) = self.parse_person(fields,2,Person.FEMALE,father_surname)
else:
- (idx,child) = self.parse_person(fields,1,gen.lib.Person.UNKNOWN,father_surname)
+ (idx,child) = self.parse_person(fields,1,Person.UNKNOWN,father_surname)
if child:
- childref = gen.lib.ChildRef()
+ childref = ChildRef()
childref.set_reference_handle(child.get_handle())
self.current_family.add_child_ref( childref)
self.db.commit_family(self.current_family,self.trans)
@@ -331,8 +331,8 @@ class GeneWebParser(object):
if birth_ref:
birth = self.db.get_event_from_handle(birth_ref.ref)
if not birth:
- birth = self.create_event(gen.lib.EventType.BIRTH)
- birth_ref = gen.lib.EventRef()
+ birth = self.create_event(EventType.BIRTH)
+ birth_ref = EventRef()
birth_ref.set_reference_handle(birth.get_handle())
child.set_birth_ref(birth_ref)
birth.set_place_handle(self.current_child_birthplace_handle)
@@ -361,7 +361,7 @@ class GeneWebParser(object):
if not self.current_family:
LOG.warn("Unknown family of child in line %d!" % self.lineno)
return None
- n = gen.lib.Note()
+ n = Note()
n.set(line)
self.db.add_note(n,self.trans)
self.current_family.add_note(n.handle)
@@ -386,7 +386,7 @@ class GeneWebParser(object):
else:
note_txt = note_txt + line
if note_txt:
- n = gen.lib.Note()
+ n = Note()
n.set(note_txt)
self.db.add_note(n,self.trans)
return n.handle
@@ -461,33 +461,33 @@ class GeneWebParser(object):
if mar_date or mar_place or mar_source:
mar = self.create_event(
- gen.lib.EventType.MARRIAGE, None, mar_date, mar_place, mar_source)
- mar_ref = gen.lib.EventRef()
+ EventType.MARRIAGE, None, mar_date, mar_place, mar_source)
+ mar_ref = EventRef()
mar_ref.set_reference_handle(mar.get_handle())
- mar_ref.set_role(gen.lib.EventRoleType.FAMILY)
+ mar_ref.set_role(EventRoleType.FAMILY)
self.current_family.add_event_ref(mar_ref)
self.current_family.set_relationship(
- gen.lib.FamilyRelType(gen.lib.FamilyRelType.MARRIED))
+ FamilyRelType(FamilyRelType.MARRIED))
if div_date:
div = self.create_event(
- gen.lib.EventType.DIVORCE, None, div_date, None, None)
- div_ref = gen.lib.EventRef()
+ EventType.DIVORCE, None, div_date, None, None)
+ div_ref = EventRef()
div_ref.set_reference_handle(div.get_handle())
- div_ref.set_role(gen.lib.EventRoleType.FAMILY)
+ div_ref.set_role(EventRoleType.FAMILY)
self.current_family.add_event_ref(div_ref)
if sep_date or engaged:
sep = self.create_event(
- gen.lib.EventType.ENGAGEMENT, None, sep_date, None, None)
- sep_ref = gen.lib.EventRef()
+ EventType.ENGAGEMENT, None, sep_date, None, None)
+ sep_ref = EventRef()
sep_ref.set_reference_handle(sep.get_handle())
- sep_ref.set_role(gen.lib.EventRoleType.FAMILY)
+ sep_ref.set_role(EventRoleType.FAMILY)
self.current_family.add_event_ref(sep_ref)
if not married:
self.current_family.set_relationship(
- gen.lib.FamilyRelType(gen.lib.FamilyRelType.UNMARRIED))
+ FamilyRelType(FamilyRelType.UNMARRIED))
self.db.commit_family(self.current_family,self.trans)
return idx
@@ -518,13 +518,13 @@ class GeneWebParser(object):
LOG.debug("Person: %s %s" % (firstname, surname))
person = self.get_or_create_person(firstname,surname)
- name = gen.lib.Name()
- name.set_type( gen.lib.NameType(gen.lib.NameType.BIRTH))
+ name = Name()
+ name.set_type( NameType(NameType.BIRTH))
name.set_first_name(firstname)
surname_obj = name.get_primary_surname()
surname_obj.set_surname(surname)
person.set_primary_name(name)
- if person.get_gender() == gen.lib.Person.UNKNOWN and gender is not None:
+ if person.get_gender() == Person.UNKNOWN and gender is not None:
person.set_gender(gender)
self.db.commit_person(person,self.trans)
personDataRe = re.compile("^[kmes0-9<>~#\[({!].*$")
@@ -582,16 +582,16 @@ class GeneWebParser(object):
if tnth: # Append title numer to title
ttitle += ", " + tnth
title = self.create_event(
- gen.lib.EventType.NOB_TITLE, ttitle, tstart, tplace)
+ EventType.NOB_TITLE, ttitle, tstart, tplace)
# TODO: Geneweb has a start date and an end date, and therefore
# supports stuff like: FROM about 1955 TO between 1998 and 1999
# gramps only supports one single date or range.
if tname and tname != "*":
- n = gen.lib.Note()
+ n = Note()
n.set(tname)
self.db.add_note(n,self.trans)
title.add_note( n.handle)
- title_ref = gen.lib.EventRef()
+ title_ref = EventRef()
title_ref.set_reference_handle(title.get_handle())
person.add_event_ref(title_ref)
elif field == '#nick' and idx < len(fields):
@@ -601,8 +601,8 @@ class GeneWebParser(object):
elif field == '#occu' and idx < len(fields):
LOG.debug("Occupation: %s" % fields[idx])
occu = self.create_event(
- gen.lib.EventType.OCCUPATION, self.decode(fields[idx]))
- occu_ref = gen.lib.EventRef()
+ EventType.OCCUPATION, self.decode(fields[idx]))
+ occu_ref = EventRef()
occu_ref.set_reference_handle(occu.get_handle())
person.add_event_ref(occu_ref)
idx += 1
@@ -699,40 +699,40 @@ class GeneWebParser(object):
if public_name:
name = person.get_primary_name()
- name.set_type(gen.lib.NameType(gen.lib.NameType.BIRTH))
+ name.set_type(NameType(NameType.BIRTH))
person.add_alternate_name(name)
- name = gen.lib.Name()
- name.set_type(gen.lib.NameType(gen.lib.NameType.AKA))
+ name = Name()
+ name.set_type(NameType(NameType.AKA))
name.set_first_name(public_name)
surname_obj = name.get_primary_surname()
surname_obj.set_surname(surname)
person.set_primary_name(name)
for aka in nick_names:
- name = gen.lib.Attribute()
- name.set_type(gen.lib.AttributeType(gen.lib.AttributeType.NICKNAME))
+ name = Attribute()
+ name.set_type(AttributeType(AttributeType.NICKNAME))
name.set_value(aka)
person.add_attribute(name)
for aka in firstname_aliases:
- name = gen.lib.Name()
- name.set_type(gen.lib.NameType(gen.lib.NameType.AKA))
+ name = Name()
+ name.set_type(NameType(NameType.AKA))
name.set_first_name(aka)
surname_obj = name.get_primary_surname()
surname_obj.set_surname(surname)
person.add_alternate_name(name)
for aka in name_aliases:
- name = gen.lib.Name()
- name.set_type(gen.lib.NameType(gen.lib.NameType.AKA))
+ name = Name()
+ name.set_type(NameType(NameType.AKA))
name.set_first_name(aka)
surname_obj = name.get_primary_surname()
surname_obj.set_surname(surname)
person.add_alternate_name(name)
for aka in surname_aliases:
- name = gen.lib.Name()
- name.set_type(gen.lib.NameType(gen.lib.NameType.AKA))
+ name = Name()
+ name.set_type(NameType(NameType.AKA))
if public_name:
name.set_first_name(public_name)
else:
@@ -745,35 +745,35 @@ class GeneWebParser(object):
person.add_citation(source.get_handle())
if birth_date or birth_place or birth_source:
- birth = self.create_event(gen.lib.EventType.BIRTH, None, birth_date, birth_place, birth_source)
- birth_ref = gen.lib.EventRef()
+ birth = self.create_event(EventType.BIRTH, None, birth_date, birth_place, birth_source)
+ birth_ref = EventRef()
birth_ref.set_reference_handle( birth.get_handle())
person.set_birth_ref( birth_ref)
if bapt_date or bapt_place or bapt_source:
- babt = self.create_event(gen.lib.EventType.BAPTISM, None, bapt_date, bapt_place, bapt_source)
- babt_ref = gen.lib.EventRef()
+ babt = self.create_event(EventType.BAPTISM, None, bapt_date, bapt_place, bapt_source)
+ babt_ref = EventRef()
babt_ref.set_reference_handle( babt.get_handle())
person.add_event_ref( babt_ref)
if death_date or death_place or death_source or death_cause:
- death = self.create_event(gen.lib.EventType.DEATH, None, death_date, death_place, death_source)
+ death = self.create_event(EventType.DEATH, None, death_date, death_place, death_source)
if death_cause:
death.set_description(death_cause)
self.db.commit_event(death,self.trans)
- death_ref = gen.lib.EventRef()
+ death_ref = EventRef()
death_ref.set_reference_handle( death.get_handle())
person.set_death_ref( death_ref)
if bur_date:
- bur = self.create_event(gen.lib.EventType.BURIAL, None, bur_date, bur_place, bur_source)
- bur_ref = gen.lib.EventRef()
+ bur = self.create_event(EventType.BURIAL, None, bur_date, bur_place, bur_source)
+ bur_ref = EventRef()
bur_ref.set_reference_handle( bur.get_handle())
person.add_event_ref( bur_ref)
if crem_date:
- crem = self.create_event(gen.lib.EventType.CREMATION, None, crem_date, bur_place, bur_source)
- crem_ref = gen.lib.EventRef()
+ crem = self.create_event(EventType.CREMATION, None, crem_date, bur_place, bur_source)
+ crem_ref = EventRef()
crem_ref.set_reference_handle( crem.get_handle())
person.add_event_ref(crem_ref)
@@ -784,27 +784,27 @@ class GeneWebParser(object):
def parse_date(self,field):
if field == "0":
return None
- date = gen.lib.Date()
+ date = Date()
matches = _text_parse.match(field)
if matches:
groups = matches.groups()
date.set_as_text(groups[0])
- date.set_modifier(gen.lib.Date.MOD_TEXTONLY)
+ date.set_modifier(Date.MOD_TEXTONLY)
return date
matches = _date_parse.match(field)
if matches:
groups = matches.groups()
- mod = _mod_map.get(groups[0],gen.lib.Date.MOD_NONE)
+ mod = _mod_map.get(groups[0],Date.MOD_NONE)
if groups[3] == "..":
- mod = gen.lib.Date.MOD_SPAN
- cal2 = _cal_map.get(groups[5],gen.lib.Date.CAL_GREGORIAN)
+ mod = Date.MOD_SPAN
+ cal2 = _cal_map.get(groups[5],Date.CAL_GREGORIAN)
sub2 = self.sub_date(groups[4])
else:
sub2 = (0,0,0)
- cal1 = _cal_map.get(groups[2],gen.lib.Date.CAL_GREGORIAN)
+ cal1 = _cal_map.get(groups[2],Date.CAL_GREGORIAN)
sub1 = self.sub_date(groups[1])
- date.set(gen.lib.Date.QUAL_NONE,mod, cal1,
+ date.set(Date.QUAL_NONE,mod, cal1,
(sub1[0],sub1[1],sub1[2],0,sub2[0],sub2[1],sub2[2],0))
return date
else:
@@ -820,9 +820,9 @@ class GeneWebParser(object):
return (int(vals[0]),int(vals[1]),int(vals[2]))
def create_event(self,type,desc=None,date=None,place=None,source=None):
- event = gen.lib.Event()
+ event = Event()
if type:
- event.set_type(gen.lib.EventType(type))
+ event.set_type(EventType(type))
if desc:
event.set_description(desc)
if date:
@@ -841,7 +841,7 @@ class GeneWebParser(object):
if mykey in self.ikeys and firstname != "?" and lastname != "?":
person = self.db.get_person_from_handle(self.ikeys[mykey])
else:
- person = gen.lib.Person()
+ person = Person()
self.db.add_person(person,self.trans)
self.db.commit_person(person,self.trans)
self.ikeys[mykey] = person.get_handle()
@@ -852,7 +852,7 @@ class GeneWebParser(object):
if place_name in self.pkeys:
place = self.db.get_place_from_handle(self.pkeys[place_name])
else:
- place = gen.lib.Place()
+ place = Place()
place.set_title(place_name)
self.db.add_place(place,self.trans)
self.db.commit_place(place,self.trans)
@@ -864,12 +864,12 @@ class GeneWebParser(object):
if source_name in self.skeys:
source = self.db.get_source_from_handle(self.skeys[source_name])
else:
- source = gen.lib.Source()
+ source = Source()
source.set_title(source_name)
self.db.add_source(source,self.trans)
self.db.commit_source(source,self.trans)
self.skeys[source_name] = source.get_handle()
- citation = gen.lib.Citation()
+ citation = Citation()
citation.set_reference_handle(source.get_handle())
self.db.add_citation(citation, self.trans)
self.db.commit_citation(citation, self.trans)
diff --git a/gramps/plugins/import/importprogen.py b/gramps/plugins/import/importprogen.py
index 75ae62ef2..2a991714e 100644
--- a/gramps/plugins/import/importprogen.py
+++ b/gramps/plugins/import/importprogen.py
@@ -49,7 +49,7 @@ log = logging.getLogger('.ImportProGen')
#-------------------------------------------------------------------------
from gen.utils.id import create_id
from gui.utils import ProgressMeter
-import gen.lib
+from gramps.gen.lib import Attribute, AttributeType, ChildRef, Date, Event, EventRef, EventType, Family, FamilyRelType, Name, NameType, Note, NoteType, Person, Place, Source, SourceRef, Surname
from gen.db import DbTxn
class ProgenError(Exception):
@@ -532,7 +532,7 @@ class ProgenParser(object):
already used (is in the db), we return the item in the db. Otherwise,
we create a new person, assign the handle and GRAMPS ID.
"""
- person = gen.lib.Person()
+ person = Person()
intid = self.gid2id.get(gramps_id)
if self.db.has_person_handle(intid):
person.unserialize(self.db.get_raw_person_data(intid))
@@ -548,7 +548,7 @@ class ProgenParser(object):
already used (is in the db), we return the item in the db. Otherwise,
we create a new family, assign the handle and GRAMPS ID.
"""
- family = gen.lib.Family()
+ family = Family()
intid = self.fid2id.get(gramps_id)
if self.db.has_family_handle(intid):
family.unserialize(self.db.get_raw_family_data(intid))
@@ -566,7 +566,7 @@ class ProgenParser(object):
place = self.db.get_place_from_handle(self.pkeys[place_name])
else:
# Create a new Place
- place = gen.lib.Place()
+ place = Place()
place.set_title(place_name)
self.db.add_place(place, self.trans)
self.db.commit_place(place, self.trans)
@@ -587,18 +587,18 @@ class ProgenParser(object):
source = self.db.get_source_from_handle(self.skeys[source_name])
else:
# Create a new Source
- source = gen.lib.Source()
+ source = Source()
source.set_title(source_name)
self.db.add_source(source, self.trans)
self.db.commit_source(source, self.trans)
self.skeys[source_name] = source.get_handle()
- sref = gen.lib.SourceRef()
+ sref = SourceRef()
sref.set_reference_handle(source.get_handle())
return sref
def __create_event_and_ref(self, type_, desc=None, date=None, place=None, source=None):
- event = gen.lib.Event()
- event.set_type(gen.lib.EventType(type_))
+ event = Event()
+ event.set_type(EventType(type_))
if desc:
event.set_description(desc)
if date:
@@ -609,7 +609,7 @@ class ProgenParser(object):
event.add_source_reference(source)
self.db.add_event(event, self.trans)
self.db.commit_event(event, self.trans)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(event.get_handle())
return event, event_ref
@@ -638,7 +638,7 @@ class ProgenParser(object):
if not txt or txt == 'onbekend' or txt == '??':
return None
- date = gen.lib.Date()
+ date = Date()
# dd-mm-yyyy
m = self.__date_pat1.match(txt)
@@ -649,7 +649,7 @@ class ProgenParser(object):
if day and month and year:
date.set_yr_mon_day(year, month, day)
else:
- date.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_ABOUT, gen.lib.Date.CAL_GREGORIAN, (day, month, year, None))
+ date.set(Date.QUAL_NONE, Date.MOD_ABOUT, Date.CAL_GREGORIAN, (day, month, year, None))
return date
# mm-yyyy
@@ -657,14 +657,14 @@ class ProgenParser(object):
if m:
month = int(m.group('month'))
year = int(m.group('year'))
- date.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_ABOUT, gen.lib.Date.CAL_GREGORIAN, (0, month, year, None))
+ date.set(Date.QUAL_NONE, Date.MOD_ABOUT, Date.CAL_GREGORIAN, (0, month, year, None))
return date
# yyy or yyyy
m = self.__date_pat3.match(txt)
if m:
year = int(m.group('year'))
- date.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_ABOUT, gen.lib.Date.CAL_GREGORIAN, (0, 0, year, None))
+ date.set(Date.QUAL_NONE, Date.MOD_ABOUT, Date.CAL_GREGORIAN, (0, 0, year, None))
return date
# voor|na|... yyyy
@@ -672,18 +672,18 @@ class ProgenParser(object):
if m:
year = int(m.group('year'))
if m.group(1) == 'voor' or m.group(1) == 'v' or m.group(1) == u'vóór':
- date.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_BEFORE, gen.lib.Date.CAL_GREGORIAN, (0, 0, year, None))
+ date.set(Date.QUAL_NONE, Date.MOD_BEFORE, Date.CAL_GREGORIAN, (0, 0, year, None))
elif m.group(1) == 'na':
- date.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_AFTER, gen.lib.Date.CAL_GREGORIAN, (0, 0, year, None))
+ date.set(Date.QUAL_NONE, Date.MOD_AFTER, Date.CAL_GREGORIAN, (0, 0, year, None))
else:
- date.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_ABOUT, gen.lib.Date.CAL_GREGORIAN, (0, 0, year, None))
+ date.set(Date.QUAL_NONE, Date.MOD_ABOUT, Date.CAL_GREGORIAN, (0, 0, year, None))
return date
# oo-oo-yyyy
m = self.__date_pat5.match(txt)
if m:
year = int(m.group('year'))
- date.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_ABOUT, gen.lib.Date.CAL_GREGORIAN, (0, 0, year, None))
+ date.set(Date.QUAL_NONE, Date.MOD_ABOUT, Date.CAL_GREGORIAN, (0, 0, year, None))
return date
# mmm yyyy (textual month)
@@ -691,7 +691,7 @@ class ProgenParser(object):
if m:
year = int(m.group('year'))
month = _cnv_month_to_int(m.group('month'))
- date.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_ABOUT, gen.lib.Date.CAL_GREGORIAN, (0, month, year, None))
+ date.set(Date.QUAL_NONE, Date.MOD_ABOUT, Date.CAL_GREGORIAN, (0, month, year, None))
return date
log.warning(_("date did not match: '%(text)s' (%(msg)s)") % {
@@ -786,11 +786,11 @@ class ProgenParser(object):
surname_prefix, surname = _split_surname(recflds[surname_ix])
gender = recflds[gender_ix]
if gender == 'M':
- gender = gen.lib.Person.MALE
+ gender = Person.MALE
elif gender == 'V':
- gender = gen.lib.Person.FEMALE
+ gender = Person.FEMALE
else:
- gender = gen.lib.Person.UNKNOWN
+ gender = Person.UNKNOWN
person = self.__find_or_create_person("I%d" % pers_id)
diag_msg = "I%d: %s %s" % (pers_id, first_name.encode('utf-8'), surname.encode('utf-8'))
@@ -798,9 +798,9 @@ class ProgenParser(object):
patronym = recflds[patron_ix]
- name = gen.lib.Name()
- name.set_type(gen.lib.NameType.BIRTH)
- sname = gen.lib.Surname()
+ name = Name()
+ name.set_type(NameType.BIRTH)
+ sname = Surname()
sname.set_surname(surname)
name.add_surname(sname)
if surname_prefix:
@@ -826,9 +826,9 @@ class ProgenParser(object):
note_txt = filter(None, [per_info, per_klad])
if note_txt:
- note = gen.lib.Note()
+ note = Note()
note.set('\n'.join(note_txt))
- note.set_type(gen.lib.NoteType.PERSON)
+ note.set_type(NoteType.PERSON)
self.db.add_note(note, self.trans)
person.add_note(note.handle)
@@ -836,18 +836,18 @@ class ProgenParser(object):
if alias:
aname = alias.split()
if len(aname) == 1:
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.NICKNAME)
+ attr = Attribute()
+ attr.set_type(AttributeType.NICKNAME)
attr.set_value(alias)
person.add_attribute(attr)
else:
# ???? Don't know if this is OK.
- name = gen.lib.Name()
- sname = gen.lib.Surname()
+ name = Name()
+ sname = Surname()
sname.set_surname(aname[-1].strip())
name.add_surname(sname)
name.set_first_name(' '.join(aname[0:-1]))
- name.set_type(gen.lib.NameType.AKA)
+ name.set_type(NameType.AKA)
person.add_alternate_name(name)
# Debug unused fields
@@ -859,7 +859,7 @@ class ProgenParser(object):
log.warning("%s: %s: '%s'" % (diag_msg, t, v))
if recflds[occu_ix]:
- event, event_ref = self.__create_event_and_ref(gen.lib.EventType.OCCUPATION, recflds[occu_ix])
+ event, event_ref = self.__create_event_and_ref(EventType.OCCUPATION, recflds[occu_ix])
person.add_event_ref(event_ref)
# Birth
@@ -874,14 +874,14 @@ class ProgenParser(object):
if date or place or info or srcref:
desc = filter(None, [info, time, source_text])
desc = desc and '; '.join(desc) or None
- event, birth_ref = self.__create_event_and_ref(gen.lib.EventType.BIRTH, desc, date, place, srcref)
+ event, birth_ref = self.__create_event_and_ref(EventType.BIRTH, desc, date, place, srcref)
person.set_birth_ref(birth_ref)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Birth, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
self.db.commit_event(event, self.trans)
@@ -897,27 +897,27 @@ class ProgenParser(object):
if date or place or info or srcref or reli or witness:
desc = filter(None, [reli, info, source_text])
desc = desc and '; '.join(desc) or None
- event, bapt_ref = self.__create_event_and_ref(gen.lib.EventType.BAPTISM, desc, date, place, srcref)
+ event, bapt_ref = self.__create_event_and_ref(EventType.BAPTISM, desc, date, place, srcref)
person.add_event_ref(bapt_ref)
if witness:
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.WITNESS)
+ attr = Attribute()
+ attr.set_type(AttributeType.WITNESS)
attr.set_value(witness)
event.add_attribute(attr)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Baptism, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Baptism, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
@@ -933,14 +933,14 @@ class ProgenParser(object):
if date or place or info or srcref:
desc = filter(None, [info, time, source_text])
desc = desc and '; '.join(desc) or None
- event, death_ref = self.__create_event_and_ref(gen.lib.EventType.DEATH, desc, date, place, srcref)
+ event, death_ref = self.__create_event_and_ref(EventType.DEATH, desc, date, place, srcref)
person.set_death_ref(death_ref)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Death, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
self.db.commit_event(event, self.trans)
@@ -954,14 +954,14 @@ class ProgenParser(object):
if date or place or info or srcref:
desc = filter(None, [info, source_text])
desc = desc and '; '.join(desc) or None
- event, burial_ref = self.__create_event_and_ref(gen.lib.EventType.BURIAL, desc, date, place, srcref)
+ event, burial_ref = self.__create_event_and_ref(EventType.BURIAL, desc, date, place, srcref)
person.add_event_ref(burial_ref)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Burial, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
self.db.commit_event(event, self.trans)
@@ -976,14 +976,14 @@ class ProgenParser(object):
# TODO. Check that not both burial and cremation took place.
desc = filter(None, [info, source_text])
desc = desc and '; '.join(desc) or None
- event, cremation_ref = self.__create_event_and_ref(gen.lib.EventType.CREMATION, desc, date, place, srcref)
+ event, cremation_ref = self.__create_event_and_ref(EventType.CREMATION, desc, date, place, srcref)
person.add_event_ref(cremation_ref)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Cremation, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
self.db.commit_event(event, self.trans)
@@ -1088,9 +1088,9 @@ class ProgenParser(object):
note_txt = filter(None, [rel_info, rel_klad])
if note_txt:
- note = gen.lib.Note()
+ note = Note()
note.set('\n'.join(note_txt))
- note.set_type(gen.lib.NoteType.FAMILY)
+ note.set_type(NoteType.FAMILY)
self.db.add_note(note, self.trans)
fam.add_note(note.handle)
@@ -1109,26 +1109,26 @@ class ProgenParser(object):
if date or place or info or srcref:
desc = filter(None, [info, source_text])
desc = desc and '; '.join(desc) or None
- event, mar_ref = self.__create_event_and_ref(gen.lib.EventType.MARRIAGE, desc, date, place, srcref)
+ event, mar_ref = self.__create_event_and_ref(EventType.MARRIAGE, desc, date, place, srcref)
fam.add_event_ref(mar_ref)
if witness:
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.WITNESS)
+ attr = Attribute()
+ attr.set_type(AttributeType.WITNESS)
attr.set_value(witness)
event.add_attribute(attr)
self.db.commit_event(event, self.trans)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Wettelijk huwelijk, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
self.db.commit_event(event, self.trans)
# Type of relation
- fam.set_relationship(gen.lib.FamilyRelType(gen.lib.FamilyRelType.MARRIED))
+ fam.set_relationship(FamilyRelType(FamilyRelType.MARRIED))
# Kerkelijk => Marriage
date = self.__create_date_from_text(recflds[marc_date_ix], diag_msg)
@@ -1142,26 +1142,26 @@ class ProgenParser(object):
desc = filter(None, [reli, info, source_text])
desc.insert(0, 'Kerkelijk huwelijk')
desc = desc and '; '.join(desc) or None
- event, marc_ref = self.__create_event_and_ref(gen.lib.EventType.MARRIAGE, desc, date, place, srcref)
+ event, marc_ref = self.__create_event_and_ref(EventType.MARRIAGE, desc, date, place, srcref)
fam.add_event_ref(marc_ref)
if witness:
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.WITNESS)
+ attr = Attribute()
+ attr.set_type(AttributeType.WITNESS)
attr.set_value(witness)
event.add_attribute(attr)
self.db.commit_event(event, self.trans)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Kerkelijk huwelijk, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
self.db.commit_event(event, self.trans)
# Type of relation
- fam.set_relationship(gen.lib.FamilyRelType(gen.lib.FamilyRelType.MARRIED))
+ fam.set_relationship(FamilyRelType(FamilyRelType.MARRIED))
# Ondertrouw => Marriage License
date = self.__create_date_from_text(recflds[marl_date_ix], diag_msg)
@@ -1174,20 +1174,20 @@ class ProgenParser(object):
desc = filter(None, [info, source_text])
desc.insert(0, 'Ondertrouw')
desc = desc and '; '.join(desc) or None
- event, marl_ref = self.__create_event_and_ref(gen.lib.EventType.MARR_LIC, desc, date, place, srcref)
+ event, marl_ref = self.__create_event_and_ref(EventType.MARR_LIC, desc, date, place, srcref)
fam.add_event_ref(marl_ref)
if witness:
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.WITNESS)
+ attr = Attribute()
+ attr.set_type(AttributeType.WITNESS)
attr.set_value(witness)
event.add_attribute(attr)
self.db.commit_event(event, self.trans)
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Ondertrouw, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
self.db.commit_event(event, self.trans)
@@ -1202,16 +1202,16 @@ class ProgenParser(object):
desc = filter(None, [info, source_text])
desc.insert(0, 'Samenwonen')
desc = desc and '; '.join(desc) or None
- event, civu_ref = self.__create_event_and_ref(gen.lib.EventType.UNKNOWN, desc, date, place, srcref)
+ event, civu_ref = self.__create_event_and_ref(EventType.UNKNOWN, desc, date, place, srcref)
fam.add_event_ref(civu_ref)
# Type of relation
- fam.set_relationship(gen.lib.FamilyRelType(gen.lib.FamilyRelType.CIVIL_UNION))
+ fam.set_relationship(FamilyRelType(FamilyRelType.CIVIL_UNION))
if source_text:
note_text = "Brontekst: " + source_text
log.warning("Samenwonen, %s: '%s'" % (diag_msg, note_text))
- note = gen.lib.Note()
+ note = Note()
note.set(note_txt)
- note.set_type(gen.lib.NoteType.EVENT)
+ note.set_type(NoteType.EVENT)
self.db.add_note(note, self.trans)
event.add_note(note.handle)
self.db.commit_event(event, self.trans)
@@ -1225,7 +1225,7 @@ class ProgenParser(object):
if date or place or info or srcref:
desc = filter(None, [info, source_text])
desc = desc and '; '.join(desc) or None
- event, div_ref = self.__create_event_and_ref(gen.lib.EventType.DIVORCE, desc, date, place, srcref)
+ event, div_ref = self.__create_event_and_ref(EventType.DIVORCE, desc, date, place, srcref)
fam.add_event_ref(div_ref)
self.db.commit_family(fam, self.trans)
@@ -1275,7 +1275,7 @@ class ProgenParser(object):
self.db.commit_person(mother_person, self.trans)
if fam:
- childref = gen.lib.ChildRef()
+ childref = ChildRef()
childref.set_reference_handle(person_handle)
fam.add_child_ref(childref)
self.db.commit_family(fam, self.trans)
diff --git a/gramps/plugins/import/importvcard.py b/gramps/plugins/import/importvcard.py
index 64866cb02..826db2aa0 100644
--- a/gramps/plugins/import/importvcard.py
+++ b/gramps/plugins/import/importvcard.py
@@ -49,7 +49,7 @@ LOG = logging.getLogger(".ImportVCard")
#
#-------------------------------------------------------------------------
from gen.errors import GrampsImportError
-import gen.lib
+from gramps.gen.lib import Address, Date, Event, EventRef, EventType, Name, NameType, Person, Surname, Url, UrlType
from gen.db import DbTxn
from gen.plug.utils import OpenFileOrStdin
@@ -298,7 +298,7 @@ class VCardParser(object):
self.finish_person()
LOG.warn("BEGIN property not properly closed by END property, "
"Gramps can't cope with nested VCards.")
- self.person = gen.lib.Person()
+ self.person = Person()
self.formatted_name = ''
self.name_parts = ''
@@ -336,13 +336,13 @@ class VCardParser(object):
if len(data_fields) != 5:
LOG.warn("VCard is malformed wrong number of name components.")
- name = gen.lib.Name()
- name.set_type(gen.lib.NameType(gen.lib.NameType.BIRTH))
+ name = Name()
+ name.set_type(NameType(NameType.BIRTH))
if data_fields[0].strip():
# assume first surname is primary
for surname_str in self.split_unescaped(data_fields[0], ','):
- surname = gen.lib.Surname()
+ surname = Surname()
prefix, sname = splitof_nameprefix(self.unesc(surname_str))
surname.set_surname(sname.strip())
surname.set_prefix(prefix.strip())
@@ -417,7 +417,7 @@ class VCardParser(object):
for nick in self.split_unescaped(data, ','):
nickname = nick.strip()
if nickname:
- name = gen.lib.Name()
+ name = Name()
name.set_nick_name(self.unesc(nickname))
self.person.add_alternate_name(name)
@@ -431,7 +431,7 @@ class VCardParser(object):
data_fields = self.split_unescaped(data, ';')
data_fields = [x.strip() for x in self.unesc(data_fields)]
if ''.join(data_fields):
- addr = gen.lib.Address()
+ addr = Address()
def add_street(strng):
if strng:
already = addr.get_street()
@@ -452,7 +452,7 @@ class VCardParser(object):
"""Read the TEL property of a VCard."""
tel = data.strip()
if tel:
- addr = gen.lib.Address()
+ addr = Address()
addr.set_phone(self.unesc(tel))
self.person.add_address(addr)
@@ -466,14 +466,14 @@ class VCardParser(object):
date_match.group(3), date_match.group(4))
else:
date_str = date_match.group(1)
- event = gen.lib.Event()
- event.set_type(gen.lib.EventType(gen.lib.EventType.BIRTH))
- date = gen.lib.Date()
+ event = Event()
+ event.set_type(EventType(EventType.BIRTH))
+ date = Date()
date.set_yr_mon_day(*[int(x, 10) for x in date_str.split('-')])
event.set_date_object(date)
self.database.add_event(event, self.trans)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(event.get_handle())
self.person.set_birth_ref(event_ref)
else:
@@ -484,12 +484,12 @@ class VCardParser(object):
"""Read the ROLE property of a VCard."""
occupation = data.strip()
if occupation:
- event = gen.lib.Event()
- event.set_type(gen.lib.EventType(gen.lib.EventType.OCCUPATION))
+ event = Event()
+ event.set_type(EventType(EventType.OCCUPATION))
event.set_description(self.unesc(occupation))
self.database.add_event(event, self.trans)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(event.get_handle())
self.person.add_event_ref(event_ref)
@@ -497,7 +497,7 @@ class VCardParser(object):
"""Read the URL property of a VCard."""
href = data.strip()
if href:
- url = gen.lib.Url()
+ url = Url()
url.set_path(self.unesc(href))
self.person.add_url(url)
@@ -505,7 +505,7 @@ class VCardParser(object):
"""Read the EMAIL property of a VCard."""
email = data.strip()
if email:
- url = gen.lib.Url()
- url.set_type(gen.lib.UrlType(gen.lib.UrlType.EMAIL))
+ url = Url()
+ url.set_type(UrlType(UrlType.EMAIL))
url.set_path(self.unesc(email))
self.person.add_url(url)
diff --git a/gramps/plugins/import/importxml.py b/gramps/plugins/import/importxml.py
index 9510f45cc..c5a0742ab 100644
--- a/gramps/plugins/import/importxml.py
+++ b/gramps/plugins/import/importxml.py
@@ -44,7 +44,7 @@ LOG = logging.getLogger(".ImportXML")
#
#-------------------------------------------------------------------------
import gen.mime
-import gen.lib
+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 gen.db import DbTxn
from gen.db.write import CLASS_TO_KEY_MAP
from gen.errors import GrampsImportError
@@ -74,12 +74,12 @@ except:
PERSON_RE = re.compile(r"\s*\',
- gen.lib.Date.CAL_FRENCH : ' ',
- gen.lib.Date.CAL_JULIAN : ' ',
- gen.lib.Date.CAL_SWEDISH : ' ',
+ Date.CAL_HEBREW : ' ',
+ Date.CAL_FRENCH : ' ',
+ Date.CAL_JULIAN : ' ',
+ Date.CAL_SWEDISH : ' ',
}
DATE_MODIFIER = {
- gen.lib.Date.MOD_ABOUT : "ABT",
- gen.lib.Date.MOD_BEFORE : "BEF",
- gen.lib.Date.MOD_AFTER : "AFT",
+ Date.MOD_ABOUT : "ABT",
+ Date.MOD_BEFORE : "BEF",
+ Date.MOD_AFTER : "AFT",
#Date.MOD_INTERPRETED : "INT",
}
DATE_QUALITY = {
- gen.lib.Date.QUAL_CALCULATED : "CAL",
- gen.lib.Date.QUAL_ESTIMATED : "EST",
+ Date.QUAL_CALCULATED : "CAL",
+ Date.QUAL_ESTIMATED : "EST",
}
#-------------------------------------------------------------------------
@@ -766,8 +766,8 @@ class GedLine(object):
this is just a text string. However, for certain tokens where we know
the context, we can provide some value. The current parsed tokens are:
- TOKEN_DATE - gen.lib.Date
- TOKEN_SEX - gen.lib.Person gender item
+ TOKEN_DATE - Date
+ TOKEN_SEX - Person gender item
TOEKN_UKNOWN - Check to see if this is a known event
"""
__DATE_CNV = GedcomDateParser()
@@ -775,9 +775,9 @@ class GedLine(object):
@staticmethod
def __extract_date(text):
"""
- Converts the specified text to a gen.lib.Date object.
+ Converts the specified text to a Date object.
"""
- dateobj = gen.lib.Date()
+ dateobj = Date()
text = text.replace('BET ABT','EST BET') # Horrible hack for importing
# illegal GEDCOM from
# Apple Macintosh Classic
@@ -788,10 +788,10 @@ class GedLine(object):
mod = ''
if match:
(mod, text) = match.groups()
- qual = QUALITY_MAP.get(mod, gen.lib.Date.QUAL_NONE)
+ qual = QUALITY_MAP.get(mod, Date.QUAL_NONE)
mod += ' '
else:
- qual = gen.lib.Date.QUAL_NONE
+ qual = Date.QUAL_NONE
# parse the range if we match, if so, return
match = RANGE.match(text)
@@ -801,13 +801,13 @@ class GedLine(object):
if match:
(cal1, data1, cal2, data2) = match.groups()
elif match1:
- cal1 = gen.lib.Date.CAL_GREGORIAN
+ cal1 = Date.CAL_GREGORIAN
(data1, cal2, data2) = match1.groups()
elif match2:
- cal2 = gen.lib.Date.CAL_GREGORIAN
+ cal2 = Date.CAL_GREGORIAN
(cal1, data1, data2) = match2.groups()
- cal1 = CALENDAR_MAP_GEDCOM2XML.get(cal1, gen.lib.Date.CAL_GREGORIAN)
- cal2 = CALENDAR_MAP_GEDCOM2XML.get(cal2, gen.lib.Date.CAL_GREGORIAN)
+ cal1 = CALENDAR_MAP_GEDCOM2XML.get(cal1, Date.CAL_GREGORIAN)
+ cal2 = CALENDAR_MAP_GEDCOM2XML.get(cal2, Date.CAL_GREGORIAN)
if cal1 != cal2:
#not supported by GRAMPS, import as text, we construct a string
# that the parser will not parse as a correct date
@@ -820,7 +820,7 @@ class GedLine(object):
data2 += CALENDAR_MAP_PARSESTRING.get(cal2, '')
start = GedLine.__DATE_CNV.parse(data1)
stop = GedLine.__DATE_CNV.parse(data2)
- dateobj.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_RANGE, cal1,
+ dateobj.set(Date.QUAL_NONE, Date.MOD_RANGE, cal1,
start.get_start_date() + stop.get_start_date())
dateobj.set_quality(qual)
return dateobj
@@ -833,13 +833,13 @@ class GedLine(object):
if match:
(cal1, data1, cal2, data2) = match.groups()
elif match1:
- cal1 = gen.lib.Date.CAL_GREGORIAN
+ cal1 = Date.CAL_GREGORIAN
(data1, cal2, data2) = match1.groups()
elif match2:
- cal2 = gen.lib.Date.CAL_GREGORIAN
+ cal2 = Date.CAL_GREGORIAN
(cal1, data1, data2) = match2.groups()
- cal1 = CALENDAR_MAP_GEDCOM2XML.get(cal1, gen.lib.Date.CAL_GREGORIAN)
- cal2 = CALENDAR_MAP_GEDCOM2XML.get(cal2, gen.lib.Date.CAL_GREGORIAN)
+ cal1 = CALENDAR_MAP_GEDCOM2XML.get(cal1, Date.CAL_GREGORIAN)
+ cal2 = CALENDAR_MAP_GEDCOM2XML.get(cal2, Date.CAL_GREGORIAN)
if cal1 != cal2:
#not supported by GRAMPS, import as text, we construct a string
# that the parser will not parse as a correct date
@@ -851,7 +851,7 @@ class GedLine(object):
data2 += CALENDAR_MAP_PARSESTRING.get(cal2, '')
start = GedLine.__DATE_CNV.parse(data1)
stop = GedLine.__DATE_CNV.parse(data2)
- dateobj.set(gen.lib.Date.QUAL_NONE, gen.lib.Date.MOD_SPAN, cal1,
+ dateobj.set(Date.QUAL_NONE, Date.MOD_SPAN, cal1,
start.get_start_date() + stop.get_start_date())
dateobj.set_quality(qual)
return dateobj
@@ -859,7 +859,7 @@ class GedLine(object):
match = CAL.match(text)
if match:
(abt, call, data) = match.groups()
- call = CALENDAR_MAP_GEDCOM2XML.get(call, gen.lib.Date.CAL_GREGORIAN)
+ call = CALENDAR_MAP_GEDCOM2XML.get(call, Date.CAL_GREGORIAN)
data += CALENDAR_MAP_PARSESTRING.get(call, '')
if abt:
dateobj = GedLine.__DATE_CNV.parse("%s %s" % (abt, data))
@@ -905,13 +905,13 @@ class GedLine(object):
"""
try:
self.data = SEX_MAP.get(self.data.strip()[0],
- gen.lib.Person.UNKNOWN)
+ Person.UNKNOWN)
except:
- self.data = gen.lib.Person.UNKNOWN
+ self.data = Person.UNKNOWN
def calc_date(self):
"""
- Converts the data field to a gen.lib.Date object
+ Converts the data field to a Date object
"""
self.data = self.__extract_date(self.data)
@@ -923,7 +923,7 @@ class GedLine(object):
"""
token = GED_TO_GRAMPS_EVENT.get(self.token_text)
if token:
- event = gen.lib.Event()
+ event = Event()
event.set_description(self.data)
event.set_type(token)
self.token = TOKEN_GEVENT
@@ -931,7 +931,7 @@ class GedLine(object):
else:
token = GED_TO_GRAMPS_ATTR.get(self.token_text)
if token:
- attr = gen.lib.Attribute()
+ attr = Attribute()
attr.set_value(self.data)
attr.set_type(token)
self.token = TOKEN_ATTR
@@ -944,16 +944,16 @@ class GedLine(object):
self.data = gid[1:-1]
def calc_nchi(self):
- attr = gen.lib.Attribute()
+ attr = Attribute()
attr.set_value(self.data)
- attr.set_type(gen.lib.AttributeType.NUM_CHILD)
+ attr.set_type(AttributeType.NUM_CHILD)
self.data = attr
self.token = TOKEN_ATTR
def calc_attr(self):
- attr = gen.lib.Attribute()
+ attr = Attribute()
attr.set_value(self.data)
- attr.set_type((gen.lib.AttributeType.CUSTOM, self.token_text))
+ attr.set_type((AttributeType.CUSTOM, self.token_text))
self.data = attr
self.token = TOKEN_ATTR
@@ -1564,27 +1564,27 @@ class PlaceParser(object):
"""
__field_map = {
- 'addr' : gen.lib.Location.set_street,
- 'subdivision' : gen.lib.Location.set_street,
- 'addr1' : gen.lib.Location.set_street,
- 'adr1' : gen.lib.Location.set_street,
- 'street' : gen.lib.Location.set_street,
- 'addr2' : gen.lib.Location.set_locality,
- 'adr2' : gen.lib.Location.set_locality,
- 'locality' : gen.lib.Location.set_locality,
- 'neighborhood' : gen.lib.Location.set_locality,
- 'city' : gen.lib.Location.set_city,
- 'town' : gen.lib.Location.set_city,
- 'village' : gen.lib.Location.set_city,
- 'county' : gen.lib.Location.set_county,
- 'country' : gen.lib.Location.set_country,
- 'state' : gen.lib.Location.set_state,
- 'state/province': gen.lib.Location.set_state,
- 'region' : gen.lib.Location.set_state,
- 'province' : gen.lib.Location.set_state,
- 'area code' : gen.lib.Location.set_postal_code,
- 'post code' : gen.lib.Location.set_postal_code,
- 'zip code' : gen.lib.Location.set_postal_code,
+ 'addr' : Location.set_street,
+ 'subdivision' : Location.set_street,
+ 'addr1' : Location.set_street,
+ 'adr1' : Location.set_street,
+ 'street' : Location.set_street,
+ 'addr2' : Location.set_locality,
+ 'adr2' : Location.set_locality,
+ 'locality' : Location.set_locality,
+ 'neighborhood' : Location.set_locality,
+ 'city' : Location.set_city,
+ 'town' : Location.set_city,
+ 'village' : Location.set_city,
+ 'county' : Location.set_county,
+ 'country' : Location.set_country,
+ 'state' : Location.set_state,
+ 'state/province': Location.set_state,
+ 'region' : Location.set_state,
+ 'province' : Location.set_state,
+ 'area code' : Location.set_postal_code,
+ 'post code' : Location.set_postal_code,
+ 'zip code' : Location.set_postal_code,
}
def __init__(self, line=None):
@@ -1597,7 +1597,7 @@ class PlaceParser(object):
"""
Parses the GEDCOM PLAC.FORM into a list of function
pointers (if possible). It does this my mapping the text strings
- (separated by commas) to the corresponding gen.lib.Location
+ (separated by commas) to the corresponding Location
method via the __field_map variable
"""
for item in line.data.split(','):
@@ -1745,14 +1745,14 @@ class GedcomParser(UpdateCallback):
"""
Parses a GEDCOM NAME value into an Name structure
"""
- name = gen.lib.Name()
+ name = Name()
match = SURNAME_RE.match(text)
if match:
#/surname/ extra, we assume extra is given name
names = match.groups()
name.set_first_name(names[1].strip())
- surn = gen.lib.Surname()
+ surn = Surname()
surn.set_surname(names[0].strip())
surn.set_primary()
name.set_surname_list([surn])
@@ -1761,7 +1761,7 @@ class GedcomParser(UpdateCallback):
names = NAME_RE.match(text).groups()
# given /surname/ extra, we assume extra is suffix
name.set_first_name(names[0].strip())
- surn = gen.lib.Surname()
+ surn = Surname()
surn.set_surname(names[2].strip())
surn.set_primary()
name.set_surname_list([surn])
@@ -1797,7 +1797,7 @@ class GedcomParser(UpdateCallback):
self.gedsource = self.gedmap.get_from_source_tag('GEDCOM 5.5')
self.use_def_src = default_source
if self.use_def_src:
- self.def_src = gen.lib.Source()
+ self.def_src = Source()
fname = os.path.basename(filename).split('\\')[-1]
self.def_src.set_title(_("Import from GEDCOM (%s)") % fname)
self.dir_path = os.path.dirname(filename)
@@ -2562,7 +2562,7 @@ class GedcomParser(UpdateCallback):
self.__parse_record()
self.__parse_trailer()
for title, handle in self.inline_srcs.iteritems():
- src = gen.lib.Source()
+ src = Source()
src.set_handle(handle)
src.set_title(title)
self.dbase.add_source(src, self.trans)
@@ -2608,7 +2608,7 @@ class GedcomParser(UpdateCallback):
already used (is in the db), we return the item in the db. Otherwise,
we create a new person, assign the handle and GRAMPS ID.
"""
- person = gen.lib.Person()
+ person = Person()
intid = self.gid2id.get(gramps_id)
if self.dbase.has_person_handle(intid):
person.unserialize(self.dbase.get_raw_person_data(intid))
@@ -2624,7 +2624,7 @@ class GedcomParser(UpdateCallback):
already used (is in the db), we return the item in the db. Otherwise,
we create a new family, assign the handle and GRAMPS ID.
"""
- family = gen.lib.Family()
+ family = Family()
# Add a counter for reordering the children later:
family.child_ref_count = 0
intid = self.fid2id.get(gramps_id)
@@ -2642,7 +2642,7 @@ class GedcomParser(UpdateCallback):
already used (is in the db), we return the item in the db. Otherwise,
we create a new media object, assign the handle and GRAMPS ID.
"""
- obj = gen.lib.MediaObject()
+ obj = MediaObject()
intid = self.oid2id.get(gramps_id)
if self.dbase.has_object_handle(intid):
obj.unserialize(self.dbase.get_raw_object_data(intid))
@@ -2660,7 +2660,7 @@ class GedcomParser(UpdateCallback):
db. Otherwise, we create a new source, assign the handle and GRAMPS ID.
"""
- obj = gen.lib.Source()
+ obj = Source()
intid = self.sid2id.get(gramps_id)
if self.dbase.has_source_handle(intid):
obj.unserialize(self.dbase.get_raw_source_data(intid))
@@ -2679,7 +2679,7 @@ class GedcomParser(UpdateCallback):
Some GEDCOM "flavors" destroy the specification, and declare the
repository inline instead of in a object.
"""
- repository = gen.lib.Repository()
+ repository = Repository()
intid = self.rid2id.get(gramps_id)
if self.dbase.has_repository_handle(intid):
repository.unserialize(self.dbase.get_raw_repository_data(intid))
@@ -2698,7 +2698,7 @@ class GedcomParser(UpdateCallback):
Some GEDCOM "flavors" destroy the specification, and declare the
repository inline instead of in a object.
"""
- note = gen.lib.Note()
+ note = Note()
if not gramps_id:
need_commit = True
gramps_id = self.dbase.find_next_note_gramps_id()
@@ -2722,7 +2722,7 @@ class GedcomParser(UpdateCallback):
already used (is in the db), we return the item in the db. Otherwise,
we create a new place, assign the handle and GRAMPS ID.
"""
- place = gen.lib.Place()
+ place = Place()
# check to see if we've encountered this name before
# if we haven't we need to get a new GRAMPS ID
@@ -2896,14 +2896,14 @@ class GedcomParser(UpdateCallback):
return
message = _("Records not imported into ") + record_name + ":\n\n" + \
state.msg
- new_note = gen.lib.Note()
+ new_note = Note()
tag = StyledTextTag(StyledTextTagType.FONTFACE, 'Monospace',
[(0, len(message))])
text = StyledText(message, [tag])
new_note.set_styledtext(text)
new_note.set_handle(create_id())
- note_type = gen.lib.NoteType()
- note_type.set((gen.lib.NoteType.CUSTOM, _("GEDCOM import")))
+ note_type = NoteType()
+ note_type.set((NoteType.CUSTOM, _("GEDCOM import")))
new_note.set_type(note_type)
self.dbase.add_note(new_note, self.trans)
# If possible, attach the note to the relevant object
@@ -3090,11 +3090,11 @@ class GedcomParser(UpdateCallback):
+1 RIN
+1 <>
"""
- researcher = gen.lib.Researcher()
+ researcher = Researcher()
state = CurrentState()
state.res = researcher
state.level = 1
- repo = gen.lib.Repository()
+ repo = Repository()
state.repo = repo
self.__parse_level(state, self.subm_parse_tbl, self.__undefined)
# If this is the submitter that we were told about in the HEADer, then
@@ -3108,7 +3108,7 @@ class GedcomParser(UpdateCallback):
repo.set_handle(create_id())
repo.set_gramps_id(self.dbase.find_next_repository_gramps_id())
- addr = gen.lib.Address()
+ addr = Address()
addr.set_street(state.res.get_address())
addr.set_locality(state.res.get_locality())
addr.set_city(state.res.get_city())
@@ -3120,20 +3120,20 @@ class GedcomParser(UpdateCallback):
repo.add_address(addr)
if state.res.get_email():
- url = gen.lib.Url()
+ url = Url()
url.set_path(state.res.get_email())
- url.set_type(gen.lib.UrlType(gen.lib.UrlType.EMAIL))
+ url.set_type(UrlType(UrlType.EMAIL))
repo.add_url(url)
- rtype = gen.lib.RepositoryType()
- rtype.set((gen.lib.RepositoryType.CUSTOM, _('GEDCOM data')))
+ rtype = RepositoryType()
+ rtype.set((RepositoryType.CUSTOM, _('GEDCOM data')))
repo.set_type(rtype)
self.__check_msgs(submitter_name, state, repo)
self.dbase.commit_repository(repo, self.trans, state.repo.change)
- repo_ref = gen.lib.RepoRef()
+ repo_ref = RepoRef()
repo_ref.set_reference_handle(repo.handle)
- mtype = gen.lib.SourceMediaType()
- mtype.set((gen.lib.SourceMediaType.UNKNOWN, ''))
+ mtype = SourceMediaType()
+ mtype.set((SourceMediaType.UNKNOWN, ''))
repo_ref.set_media_type(mtype)
self.def_src.add_repo_reference(repo_ref)
self.dbase.commit_source(self.def_src, self.trans)
@@ -3304,8 +3304,8 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
- attr.set_type((gen.lib.AttributeType.CUSTOM, line.token_text))
+ attr = Attribute()
+ attr.set_type((AttributeType.CUSTOM, line.token_text))
attr.set_value(line.data)
state.person.add_attribute(attr)
@@ -3320,7 +3320,7 @@ class GedcomParser(UpdateCallback):
# parse table is encountered. It is remotely possible that this is
# actally a DATE tag, in which case line.data will be a date object, so
# we need to convert it back to a string here.
- event_ref = self.__build_event_pair(state, gen.lib.EventType.CUSTOM,
+ event_ref = self.__build_event_pair(state, EventType.CUSTOM,
self.event_parse_tbl,
str(line.data))
state.person.add_event_ref(event_ref)
@@ -3333,7 +3333,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
event_ref = self.__build_family_event_pair(state,
- gen.lib.EventType.CUSTOM,
+ EventType.CUSTOM,
self.event_parse_tbl,
line.data)
state.family.add_event_ref(event_ref)
@@ -3356,8 +3356,8 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
- attr.set_type((gen.lib.AttributeType.CUSTOM, 'RESN'))
+ attr = Attribute()
+ attr.set_type((AttributeType.CUSTOM, 'RESN'))
state.person.add_attribute(attr)
def __person_alt_name(self, line, state):
@@ -3400,7 +3400,7 @@ class GedcomParser(UpdateCallback):
"""
if line.data[0] == '@':
handle = self.__find_person_handle(self.pid_map[line.data])
- ref = gen.lib.PersonRef()
+ ref = PersonRef()
ref.ref = handle
ref.rel = "Alias"
state.person.add_person_ref(ref)
@@ -3433,7 +3433,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
name = self.__parse_name_personal(line.data)
- name.set_type(gen.lib.NameType.AKA)
+ name.set_type(NameType.AKA)
state.person.add_alternate_name(name)
# Create a new state, and parse the remainder of the NAME level
@@ -3470,7 +3470,7 @@ class GedcomParser(UpdateCallback):
gramps_id = self.oid_map[line.data]
handle = self.__find_object_handle(gramps_id)
- ref = gen.lib.MediaRef()
+ ref = MediaRef()
ref.set_reference_handle(handle)
state.person.add_media_reference(ref)
else:
@@ -3507,7 +3507,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
- # build a gen.lib.Name structure from the text
+ # build a Name structure from the text
name = self.__parse_name_personal(line.data)
@@ -3518,10 +3518,10 @@ class GedcomParser(UpdateCallback):
# of different name types
if state.name_cnt == 0:
- name.set_type(gen.lib.NameType.BIRTH)
+ name.set_type(NameType.BIRTH)
state.person.set_primary_name(name)
else:
- name.set_type(gen.lib.NameType.AKA)
+ name.set_type(NameType.AKA)
state.person.add_alternate_name(name)
state.name_cnt += 1
@@ -3559,7 +3559,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- event_ref = self.__build_event_pair(state, gen.lib.EventType.CUSTOM,
+ event_ref = self.__build_event_pair(state, EventType.CUSTOM,
self.event_parse_tbl, line.data)
state.person.add_event_ref(event_ref)
@@ -3578,7 +3578,7 @@ class GedcomParser(UpdateCallback):
event = line.data
event.set_gramps_id(self.emapper.find_next())
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
self.dbase.add_event(event, self.trans)
sub_state = CurrentState()
@@ -3606,7 +3606,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- event_ref = self.__build_event_pair(state, gen.lib.EventType.RELIGION,
+ event_ref = self.__build_event_pair(state, EventType.RELIGION,
self.event_parse_tbl, line.data)
state.person.add_event_ref(event_ref)
@@ -3629,7 +3629,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- event_ref = self.__build_event_pair(state, gen.lib.EventType.BIRTH,
+ event_ref = self.__build_event_pair(state, EventType.BIRTH,
self.event_parse_tbl, line.data)
if state.person.get_birth_ref():
state.person.add_event_ref(event_ref)
@@ -3651,7 +3651,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- event_ref = self.__build_event_pair(state, gen.lib.EventType.ADOPT,
+ event_ref = self.__build_event_pair(state, EventType.ADOPT,
self.adopt_parse_tbl, line.data)
state.person.add_event_ref(event_ref)
@@ -3669,7 +3669,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- event_ref = self.__build_event_pair(state, gen.lib.EventType.DEATH,
+ event_ref = self.__build_event_pair(state, EventType.DEATH,
self.event_parse_tbl, line.data)
if state.person.get_death_ref():
state.person.add_event_ref(event_ref)
@@ -3719,7 +3719,7 @@ class GedcomParser(UpdateCallback):
"""
sub_state = CurrentState()
sub_state.level = state.level+1
- sub_state.addr = gen.lib.Address()
+ sub_state.addr = Address()
sub_state.addr.set_street(line.data)
state.person.add_address(sub_state.addr)
self.__parse_level(sub_state, self.parse_addr_tbl, self.__ignore)
@@ -3734,7 +3734,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- addr = gen.lib.Address()
+ addr = Address()
addr.set_street("Unknown")
addr.set_phone(line.data)
state.person.add_address(addr)
@@ -3750,9 +3750,9 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- url = gen.lib.Url()
+ url = Url()
url.set_path(line.data)
- url.set_type(gen.lib.UrlType(gen.lib.UrlType.EMAIL))
+ url.set_type(UrlType(UrlType.EMAIL))
state.person.add_url(url)
def __person_url(self, line, state):
@@ -3765,9 +3765,9 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- url = gen.lib.Url()
+ url = Url()
url.set_path(line.data)
- url.set_type(gen.lib.UrlType(gen.lib.UrlType.WEB_HOME))
+ url.set_type(UrlType(UrlType.WEB_HOME))
state.person.add_url(url)
def __person_titl(self, line, state):
@@ -3777,10 +3777,10 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- event = gen.lib.Event()
- event_ref = gen.lib.EventRef()
+ event = Event()
+ event_ref = EventRef()
event.set_gramps_id(self.emapper.find_next())
- event.set_type(gen.lib.EventType.NOB_TITLE)
+ event.set_type(EventType.NOB_TITLE)
event.set_description(line.data)
sub_state = CurrentState()
@@ -3814,11 +3814,11 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if line.data.upper() in ("_OTHN", "_AKA", "AKA", "AKAN"):
- state.name.set_type(gen.lib.NameType.AKA)
+ state.name.set_type(NameType.AKA)
elif line.data.upper() in ("_MAR", "_MARN", "_MARNM", "MARRIED"):
- state.name.set_type(gen.lib.NameType.MARRIED)
+ state.name.set_type(NameType.MARRIED)
else:
- state.name.set_type((gen.lib.NameType.CUSTOM, line.data))
+ state.name.set_type((NameType.CUSTOM, line.data))
def __name_date(self, line, state):
"""
@@ -3914,7 +3914,7 @@ class GedcomParser(UpdateCallback):
if state.name.get_surname_list():
state.name.get_surname_list()[0].set_prefix(line.data.strip())
else:
- surn = gen.lib.Surname()
+ surn = Surname()
surn.set_prefix(line.data.strip())
surn.set_primary()
state.name.set_surname_list([surn])
@@ -3930,7 +3930,7 @@ class GedcomParser(UpdateCallback):
if state.name.get_surname_list():
state.name.get_surname_list()[0].set_surname(line.data.strip())
else:
- surn = gen.lib.Surname()
+ surn = Surname()
surn.set_surname(line.data.strip())
surn.set_primary()
state.name.set_surname_list([surn])
@@ -3956,16 +3956,16 @@ class GedcomParser(UpdateCallback):
text = line.data.strip()
data = text.split()
if len(data) == 1:
- name = gen.lib.Name(state.person.primary_name)
- surn = gen.lib.Surname()
+ name = Name(state.person.primary_name)
+ surn = Surname()
surn.set_surname(data[0].strip())
surn.set_primary()
name.set_surname_list([surn])
- name.set_type(gen.lib.NameType.MARRIED)
+ name.set_type(NameType.MARRIED)
state.person.add_alternate_name(name)
elif len(data) > 1:
name = self.__parse_name_personal(text)
- name.set_type(gen.lib.NameType.MARRIED)
+ name.set_type(NameType.MARRIED)
state.person.add_alternate_name(name)
def __name_nsfx(self, line, state):
@@ -4020,19 +4020,19 @@ class GedcomParser(UpdateCallback):
lname = line.data.split()
name_len = len(lname)
if name_len == 1:
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.NICKNAME)
+ attr = Attribute()
+ attr.set_type(AttributeType.NICKNAME)
attr.set_value(line.data)
state.person.add_attribute(attr)
else:
- name = gen.lib.Name()
- surname = gen.lib.Surname()
+ name = Name()
+ surname = Surname()
surname.set_surname(lname[-1].strip())
surname.set_primary()
name.set_surname_list([surname])
name.set_first_name(' '.join(lname[0:name_len-1]))
# name = self.__parse_name_personal(line.data)
- name.set_type(gen.lib.NameType.AKA)
+ name.set_type(NameType.AKA)
state.person.add_alternate_name(name)
def __name_adpn(self, line, state):
@@ -4045,16 +4045,16 @@ class GedcomParser(UpdateCallback):
text = line.data.strip()
data = text.split()
if len(data) == 1:
- name = gen.lib.Name(state.person.primary_name)
- surn = gen.lib.Surname()
+ name = Name(state.person.primary_name)
+ surn = Surname()
surn.set_surname(data[0].strip())
surn.set_primary()
name.set_surname_list([surn])
- name.set_type((gen.lib.NameType.CUSTOM, "Adopted"))
+ name.set_type((NameType.CUSTOM, "Adopted"))
state.person.add_alternate_name(name)
elif len(data) > 1:
name = self.__parse_name_personal(text)
- name.set_type((gen.lib.NameType.CUSTOM, "Adopted"))
+ name.set_type((NameType.CUSTOM, "Adopted"))
state.person.add_alternate_name(name)
@@ -4097,7 +4097,7 @@ class GedcomParser(UpdateCallback):
"""
sub_state = CurrentState()
sub_state.person = state.person
- sub_state.attr = gen.lib.Attribute()
+ sub_state.attr = Attribute()
sub_state.attr.set_value(line.data)
sub_state.level = state.level+1
state.person.add_attribute(sub_state.attr)
@@ -4117,7 +4117,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- self.build_lds_ord(state, gen.lib.LdsOrd.BAPTISM)
+ self.build_lds_ord(state, LdsOrd.BAPTISM)
def __person_conl(self, line, state):
"""
@@ -4128,7 +4128,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- self.build_lds_ord(state, gen.lib.LdsOrd.CONFIRMATION)
+ self.build_lds_ord(state, LdsOrd.CONFIRMATION)
def __person_endl(self, line, state):
"""
@@ -4139,7 +4139,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- self.build_lds_ord(state, gen.lib.LdsOrd.ENDOWMENT)
+ self.build_lds_ord(state, LdsOrd.ENDOWMENT)
def __person_slgc(self, line, state):
"""
@@ -4150,7 +4150,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- self.build_lds_ord(state, gen.lib.LdsOrd.SEAL_TO_PARENTS)
+ self.build_lds_ord(state, LdsOrd.SEAL_TO_PARENTS)
def build_lds_ord(self, state, lds_type):
"""
@@ -4163,7 +4163,7 @@ class GedcomParser(UpdateCallback):
"""
sub_state = CurrentState()
sub_state.level = state.level + 1
- sub_state.lds_ord = gen.lib.LdsOrd()
+ sub_state.lds_ord = LdsOrd()
sub_state.lds_ord.set_type(lds_type)
sub_state.place = None
sub_state.place_fields = PlaceParser()
@@ -4274,7 +4274,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- status = LDS_STATUS.get(line.data, gen.lib.LdsOrd.STATUS_NONE)
+ status = LDS_STATUS.get(line.data, LdsOrd.STATUS_NONE)
state.lds_ord.set_status(status)
def __person_famc(self, line, state):
@@ -4327,7 +4327,7 @@ class GedcomParser(UpdateCallback):
ref.set_father_relation(sub_state.ftype)
break
else:
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = state.person.handle
if sub_state.ftype:
ref.set_mother_relation(sub_state.ftype)
@@ -4349,7 +4349,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
state.ftype = PEDIGREE_TYPES.get(line.data.lower(),
- gen.lib.ChildRefType.UNKNOWN)
+ ChildRefType.UNKNOWN)
def __person_famc_note(self, line, state):
"""
@@ -4443,7 +4443,7 @@ class GedcomParser(UpdateCallback):
sub_state = CurrentState()
sub_state.person = state.person
sub_state.level = state.level + 1
- sub_state.ref = gen.lib.PersonRef()
+ sub_state.ref = PersonRef()
sub_state.ref.ref = handle
sub_state.ignore = False
@@ -4590,8 +4590,8 @@ class GedcomParser(UpdateCallback):
"""
event = line.data
event.set_gramps_id(self.emapper.find_next())
- event_ref = gen.lib.EventRef()
- event_ref.set_role(gen.lib.EventRoleType.FAMILY)
+ event_ref = EventRef()
+ event_ref.set_role(EventRoleType.FAMILY)
self.dbase.add_event(event, self.trans)
sub_state = CurrentState()
@@ -4603,16 +4603,16 @@ class GedcomParser(UpdateCallback):
self.__parse_level(sub_state, self.event_parse_tbl, self.__undefined)
state.msg += sub_state.msg
- if event.type == gen.lib.EventType.MARRIAGE:
+ if event.type == EventType.MARRIAGE:
descr = event.get_description()
if descr == "Civil Union":
- state.family.type.set(gen.lib.FamilyRelType.CIVIL_UNION)
+ state.family.type.set(FamilyRelType.CIVIL_UNION)
event.set_description('')
elif descr == "Unmarried":
- state.family.type.set(gen.lib.FamilyRelType.UNMARRIED)
+ state.family.type.set(FamilyRelType.UNMARRIED)
event.set_description('')
else:
- state.family.type.set(gen.lib.FamilyRelType.MARRIED)
+ state.family.type.set(FamilyRelType.MARRIED)
self.dbase.commit_event(event, self.trans)
event_ref.ref = event.handle
@@ -4630,9 +4630,9 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- event = gen.lib.Event()
- event_ref = gen.lib.EventRef()
- event_ref.set_role(gen.lib.EventRoleType.FAMILY)
+ event = Event()
+ event_ref = EventRef()
+ event_ref.set_role(EventRoleType.FAMILY)
event.set_gramps_id(self.emapper.find_next())
event.set_type(line.data)
self.dbase.add_event(event, self.trans)
@@ -4684,7 +4684,7 @@ class GedcomParser(UpdateCallback):
# then we will set the order now:
self.set_child_ref_order(state.family, ref)
else:
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = child.handle
if sub_state.frel:
ref.set_father_relation(sub_state.frel)
@@ -4719,8 +4719,8 @@ class GedcomParser(UpdateCallback):
"""
sub_state = CurrentState()
sub_state.level = state.level + 1
- sub_state.lds_ord = gen.lib.LdsOrd()
- sub_state.lds_ord.set_type(gen.lib.LdsOrd.SEAL_TO_SPOUSE)
+ sub_state.lds_ord = LdsOrd()
+ sub_state.lds_ord.set_type(LdsOrd.SEAL_TO_SPOUSE)
sub_state.place = None
sub_state.family = state.family
sub_state.place_fields = PlaceParser()
@@ -4771,7 +4771,7 @@ class GedcomParser(UpdateCallback):
gramps_id = self.oid_map[line.data]
handle = self.__find_object_handle(gramps_id)
- ref = gen.lib.MediaRef()
+ ref = MediaRef()
ref.set_reference_handle(handle)
state.family.add_media_reference(ref)
else:
@@ -4822,7 +4822,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- state.addr = gen.lib.Address()
+ state.addr = Address()
state.addr.set_street(line.data)
self.__parse_level(state, self.parse_addr_tbl, self.__ignore)
@@ -4842,7 +4842,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
+ attr = Attribute()
attr.set_type(line.token_text)
attr.set_value(line.data)
state.family.add_attribute(attr)
@@ -4980,7 +4980,7 @@ class GedcomParser(UpdateCallback):
gramps_id = self.oid_map[line.data]
handle = self.__find_object_handle(gramps_id)
- ref = gen.lib.MediaRef()
+ ref = MediaRef()
ref.set_reference_handle(handle)
state.event.add_media_reference(ref)
else:
@@ -5002,17 +5002,17 @@ class GedcomParser(UpdateCallback):
"""
if state.event.get_type().is_custom():
if line.data in GED_TO_GRAMPS_EVENT:
- name = gen.lib.EventType(GED_TO_GRAMPS_EVENT[line.data])
+ name = EventType(GED_TO_GRAMPS_EVENT[line.data])
else:
val = self.gedsource.tag2gramps(line.data)
if val:
- name = gen.lib.EventType((gen.lib.EventType.CUSTOM, val))
+ name = EventType((EventType.CUSTOM, val))
else:
try:
- name = gen.lib.EventType((gen.lib.EventType.CUSTOM,
+ name = EventType((EventType.CUSTOM,
line.data))
except AttributeError:
- name = gen.lib.EventType(gen.lib.EventType.UNKNOWN)
+ name = EventType(EventType.UNKNOWN)
state.event.set_type(name)
else:
try:
@@ -5060,7 +5060,7 @@ class GedcomParser(UpdateCallback):
if place_handle:
place = self.dbase.get_place_from_handle(place_handle)
location = place.get_main_location()
- empty_loc = gen.lib.Location()
+ empty_loc = Location()
place.set_main_location(empty_loc)
else:
place = self.__find_or_create_place(line.data)
@@ -5116,7 +5116,7 @@ class GedcomParser(UpdateCallback):
gramps_id = self.oid_map[line.data]
handle = self.__find_object_handle(gramps_id)
- ref = gen.lib.MediaRef()
+ ref = MediaRef()
ref.set_reference_handle(handle)
state.place.add_media_reference(ref)
else:
@@ -5182,7 +5182,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
sub_state = CurrentState(level=state.level+1)
- sub_state.location = gen.lib.Location()
+ sub_state.location = Location()
sub_state.location.set_street(line.data)
sub_state.note = []
sub_state.event = state.event
@@ -5212,7 +5212,7 @@ class GedcomParser(UpdateCallback):
def __add_location(self, place, location):
"""
@param place: A place object we have found or created
- @type place: gen.lib.Place
+ @type place: Place
@param location: A location we want to add to this place
@type location: gen.lib.location
"""
@@ -5277,7 +5277,7 @@ class GedcomParser(UpdateCallback):
self.__add_msg(_("Empty event note ignored"), line, state)
self.__skip_subordinate_levels(state.level+2, state)
else:
- new_note = gen.lib.Note(line.data)
+ new_note = Note(line.data)
new_note.set_handle(create_id())
self.dbase.add_note(new_note, self.trans)
self.__skip_subordinate_levels(state.level+2, state)
@@ -5299,7 +5299,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
+ attr = Attribute()
attr.set_type(line.token_text)
attr.set_value(line.data)
state.event.add_attribute(attr)
@@ -5320,7 +5320,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
+ attr = Attribute()
attr.set_type(line.token_text)
attr.set_value(line.data)
state.event.add_attribute(attr)
@@ -5332,7 +5332,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
+ attr = Attribute()
attr.set_type(line.token_text)
attr.set_value(line.data)
state.event.add_attribute(attr)
@@ -5344,8 +5344,8 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.CAUSE)
+ attr = Attribute()
+ attr.set_type(AttributeType.CAUSE)
attr.set_value(line.data)
state.event.add_attribute(attr)
@@ -5373,8 +5373,8 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.AGE)
+ attr = Attribute()
+ attr.set_type(AttributeType.AGE)
attr.set_value(line.data)
state.event_ref.add_attribute(attr)
@@ -5390,8 +5390,8 @@ class GedcomParser(UpdateCallback):
if self.__level_is_finished(line, state.level):
break
elif line.token == TOKEN_AGE:
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.FATHER_AGE)
+ attr = Attribute()
+ attr.set_type(AttributeType.FATHER_AGE)
attr.set_value(line.data)
state.event_ref.add_attribute(attr)
elif line.token == TOKEN_WIFE:
@@ -5411,8 +5411,8 @@ class GedcomParser(UpdateCallback):
if self.__level_is_finished(line, state.level):
break
elif line.token == TOKEN_AGE:
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.MOTHER_AGE)
+ attr = Attribute()
+ attr.set_type(AttributeType.MOTHER_AGE)
attr.set_value(line.data)
state.event_ref.add_attribute(attr)
elif line.token == TOKEN_HUSB:
@@ -5427,8 +5427,8 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.AGENCY)
+ attr = Attribute()
+ attr.set_type(AttributeType.AGENCY)
attr.set_value(line.data)
state.event.add_attribute(attr)
@@ -5441,8 +5441,8 @@ class GedcomParser(UpdateCallback):
"""
if hasattr(state, 'event'):
#read in time as attribute of event
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.TIME)
+ attr = Attribute()
+ attr.set_type(AttributeType.TIME)
attr.set_value(line.data)
state.event.add_attribute(attr)
@@ -5460,7 +5460,7 @@ class GedcomParser(UpdateCallback):
# +1 TYPE
assert( state.event.handle) # event handle is required to be set
wit = self.__find_or_create_person(self.pid_map[line.data])
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(state.event.handle)
while True:
line = self.__get_next_line()
@@ -5468,18 +5468,18 @@ class GedcomParser(UpdateCallback):
break
elif line.token == TOKEN_TYPE:
if line.data in ("WITNESS_OF_MARRIAGE"):
- role = gen.lib.EventRoleType(
- gen.lib.EventRoleType.WITNESS)
+ role = EventRoleType(
+ EventRoleType.WITNESS)
else:
- role = gen.lib.EventRoleType(
- (gen.lib.EventRoleType.CUSTOM, line.data))
+ role = EventRoleType(
+ (EventRoleType.CUSTOM, line.data))
event_ref.set_role(role)
wit.add_event_ref(event_ref)
self.dbase.commit_person(wit, self.trans)
else:
# n _WITN
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.WITNESS)
+ attr = Attribute()
+ attr.set_type(AttributeType.WITNESS)
attr.set_value(line.data)
state.event.add_attribute(attr)
@@ -5502,8 +5502,8 @@ class GedcomParser(UpdateCallback):
self.__undefined)
state.msg += sub_state.msg
- if (int(sub_state.mrel) == gen.lib.ChildRefType.BIRTH and
- int(sub_state.frel) == gen.lib.ChildRefType.BIRTH):
+ if (int(sub_state.mrel) == ChildRefType.BIRTH and
+ int(sub_state.frel) == ChildRefType.BIRTH):
sub_state.mrel = sub_state.frel = TYPE_ADOPT
if state.person.get_main_parents_family_handle() == handle:
@@ -5517,7 +5517,7 @@ class GedcomParser(UpdateCallback):
ref.set_father_relation(sub_state.frel)
ref.set_mother_relation(sub_state.mrel)
else:
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = state.person.handle
ref.set_father_relation(sub_state.frel)
ref.set_mother_relation(sub_state.mrel)
@@ -5552,7 +5552,7 @@ class GedcomParser(UpdateCallback):
state.person.set_main_parent_family_handle(None)
state.person.add_parent_family_handle(handle)
- frel = mrel = gen.lib.ChildRefType.BIRTH
+ frel = mrel = ChildRefType.BIRTH
family, new = self.dbase.find_family_from_handle(handle, self.trans)
reflist = [ref for ref in family.get_child_ref_list()
@@ -5562,7 +5562,7 @@ class GedcomParser(UpdateCallback):
ref.set_father_relation(frel)
ref.set_mother_relation(mrel)
else:
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = state.person.handle
ref.set_father_relation(frel)
ref.set_mother_relation(mrel)
@@ -5712,21 +5712,21 @@ class GedcomParser(UpdateCallback):
state.citation.set_date_object(line.data)
def __source_text(self, line, state):
- note = gen.lib.Note()
+ note = Note()
note.set(line.data)
gramps_id = self.dbase.find_next_note_gramps_id()
note.set_gramps_id(gramps_id)
- note.set_type(gen.lib.NoteType.SOURCE_TEXT)
+ note.set_type(NoteType.SOURCE_TEXT)
self.dbase.add_note(note, self.trans)
state.source.add_note(note.get_handle())
def __citation_data_text(self, line, state):
- note = gen.lib.Note()
+ note = Note()
note.set(line.data)
gramps_id = self.dbase.find_next_note_gramps_id()
note.set_gramps_id(gramps_id)
- note.set_type(gen.lib.NoteType.SOURCE_TEXT)
+ note.set_type(NoteType.SOURCE_TEXT)
self.dbase.add_note(note, self.trans)
state.citation.add_note(note.get_handle())
@@ -5748,7 +5748,7 @@ class GedcomParser(UpdateCallback):
gramps_id = self.oid_map[line.data]
handle = self.__find_object_handle(gramps_id)
- ref = gen.lib.MediaRef()
+ ref = MediaRef()
ref.set_reference_handle(handle)
state.citation.add_media_reference(ref)
else:
@@ -5891,7 +5891,7 @@ class GedcomParser(UpdateCallback):
gramps_id = self.oid_map[line.data]
handle = self.__find_object_handle(gramps_id)
- ref = gen.lib.MediaRef()
+ ref = MediaRef()
ref.set_reference_handle(handle)
state.source.add_media_reference(ref)
else:
@@ -5936,7 +5936,7 @@ class GedcomParser(UpdateCallback):
self.repo2id[line.data] = repo.get_gramps_id()
repo.set_name(line.data)
self.dbase.commit_repository(repo, self.trans)
- repo_ref = gen.lib.RepoRef()
+ repo_ref = RepoRef()
repo_ref.set_reference_handle(repo.handle)
sub_state = CurrentState()
@@ -5961,7 +5961,7 @@ class GedcomParser(UpdateCallback):
def __repo_ref_medi(self, line, state):
name = line.data
mtype = MEDIA_MAP.get(name.lower(),
- (gen.lib.SourceMediaType.CUSTOM, name))
+ (SourceMediaType.CUSTOM, name))
state.repo_ref.set_media_type(mtype)
def __repo_ref_note(self, line, state):
@@ -5998,8 +5998,8 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- attr = gen.lib.Attribute()
- attr.set_type(gen.lib.AttributeType.AGENCY)
+ attr = Attribute()
+ attr.set_type(AttributeType.AGENCY)
attr.set_value(line.data)
state.source.add_attribute(attr)
@@ -6302,7 +6302,7 @@ class GedcomParser(UpdateCallback):
if this happened, and try to fix it.
"""
- addr = gen.lib.Address()
+ addr = Address()
addr.set_street(line.data)
sub_state = CurrentState()
@@ -6360,9 +6360,9 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- url = gen.lib.Url()
+ url = Url()
url.set_path(line.data)
- url.set_type(gen.lib.UrlType(gen.lib.UrlType.WEB_HOME))
+ url.set_type(UrlType(UrlType.WEB_HOME))
state.repo.add_url(url)
def __repo_email(self, line, state):
@@ -6372,9 +6372,9 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- url = gen.lib.Url()
+ url = Url()
url.set_path(line.data)
- url.set_type(gen.lib.UrlType(gen.lib.UrlType.EMAIL))
+ url.set_type(UrlType(UrlType.EMAIL))
state.repo.add_url(url)
def __location_addr(self, line, state):
@@ -6385,7 +6385,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
val = state.location.get_street()
if val:
val = "%s, %s" % (val, line.data.strip())
@@ -6401,7 +6401,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
state.location.set_date_object(line.data)
def __location_adr1(self, line, state):
@@ -6412,7 +6412,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
if state.location.get_street() != "":
self.__add_msg(_("Warn: ADDR overwritten"), line, state)
state.location.set_street(line.data)
@@ -6425,7 +6425,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
state.location.set_locality(line.data)
def __location_city(self, line, state):
@@ -6436,7 +6436,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
state.location.set_city(line.data)
def __location_stae(self, line, state):
@@ -6447,7 +6447,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
state.location.set_state(line.data)
def __location_post(self, line, state):
@@ -6458,7 +6458,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
state.location.set_postal_code(line.data)
def __location_ctry(self, line, state):
@@ -6469,7 +6469,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
state.location.set_country(line.data)
def __location_note(self, line, state):
@@ -6480,7 +6480,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
if not state.location:
- state.location = gen.lib.Location()
+ state.location = Location()
if state.event:
self.__parse_note(line, state.event, state.level+1, state)
else:
@@ -6601,7 +6601,7 @@ class GedcomParser(UpdateCallback):
@param state: The current state
@type state: CurrentState
"""
- repo = gen.lib.Repository()
+ repo = Repository()
sub_state = CurrentState(level=state.level + 1)
sub_state.repo = repo
self.__parse_level(sub_state, self.header_corp_addr, self.__undefined)
@@ -6610,14 +6610,14 @@ class GedcomParser(UpdateCallback):
if self.use_def_src:
repo.set_name(_("Business that produced the product: %s") %
line.data)
- rtype = gen.lib.RepositoryType()
- rtype.set((gen.lib.RepositoryType.CUSTOM, _('GEDCOM data')))
+ rtype = RepositoryType()
+ rtype.set((RepositoryType.CUSTOM, _('GEDCOM data')))
repo.set_type(rtype)
self.dbase.add_repository(repo, self.trans)
- repo_ref = gen.lib.RepoRef()
+ repo_ref = RepoRef()
repo_ref.set_reference_handle(repo.handle)
- mtype = gen.lib.SourceMediaType()
- mtype.set((gen.lib.SourceMediaType.UNKNOWN, ''))
+ mtype = SourceMediaType()
+ mtype.set((SourceMediaType.UNKNOWN, ''))
repo_ref.set_media_type(mtype)
self.def_src.add_repo_reference(repo_ref)
@@ -6885,7 +6885,7 @@ class GedcomParser(UpdateCallback):
self.__add_msg(_("Empty note ignored"), line, state)
self.__skip_subordinate_levels(level+1, state)
else:
- new_note = gen.lib.Note(line.data)
+ new_note = Note(line.data)
new_note.set_gramps_id(self.nid_map[""])
new_note.set_handle(create_id())
@@ -6924,7 +6924,7 @@ class GedcomParser(UpdateCallback):
else:
gid = self.nid_map[line.token_text]
handle = self.__find_note_handle(gid)
- new_note = gen.lib.Note(line.data)
+ new_note = Note(line.data)
new_note.set_handle(handle)
new_note.set_gramps_id(gid)
@@ -7007,11 +7007,11 @@ class GedcomParser(UpdateCallback):
Handle the specified source, building a source reference to
the object.
"""
- citation = gen.lib.Citation()
+ citation = Citation()
if line.data and line.data[0] != "@":
title = line.data
handle = self.inline_srcs.get(title, create_id())
- src = gen.lib.Source()
+ src = Source()
src.handle = handle
src.gramps_id = self.dbase.find_next_source_gramps_id()
self.inline_srcs[title] = handle
@@ -7092,10 +7092,10 @@ class GedcomParser(UpdateCallback):
def build_media_object(self, obj, form, filename, title, note):
if isinstance(form, basestring) and form.lower() == "url":
- url = gen.lib.Url()
+ url = Url()
url.set_path(filename)
url.set_description(title)
- url.set_type(gen.lib.UrlType.WEB_HOME)
+ url.set_type(UrlType.WEB_HOME)
obj.add_url(url)
else:
# to allow import of references to URLs (especially for import from
@@ -7110,7 +7110,7 @@ class GedcomParser(UpdateCallback):
path = filename
photo_handle = self.media_map.get(path)
if photo_handle is None:
- photo = gen.lib.MediaObject()
+ photo = MediaObject()
photo.set_path(path)
photo.set_description(title)
full_path = os.path.abspath(path)
@@ -7122,7 +7122,7 @@ class GedcomParser(UpdateCallback):
self.media_map[path] = photo.handle
else:
photo = self.dbase.get_object_from_handle(photo_handle)
- oref = gen.lib.MediaRef()
+ oref = MediaRef()
oref.set_reference_handle(photo.handle)
if note:
gramps_id = self.nid_map[note]
@@ -7142,8 +7142,8 @@ class GedcomParser(UpdateCallback):
n <> {0:M} p.*, *
n <> {0:M} p.
"""
- event = gen.lib.Event()
- event_ref = gen.lib.EventRef()
+ event = Event()
+ event_ref = EventRef()
event.set_gramps_id(self.emapper.find_next())
event.set_type(event_type)
@@ -7166,8 +7166,8 @@ class GedcomParser(UpdateCallback):
def __build_family_event_pair(self, state, event_type, event_map,
description):
- event = gen.lib.Event()
- event_ref = gen.lib.EventRef()
+ event = Event()
+ event_ref = EventRef()
event.set_gramps_id(self.emapper.find_next())
event.set_type(event_type)
if description and description != 'Y':
@@ -7214,7 +7214,7 @@ class GedcomParser(UpdateCallback):
Add the default source to the object.
"""
if self.use_def_src and len(obj.get_citation_list()) == 0:
- citation = gen.lib.Citation()
+ citation = Citation()
citation.set_reference_handle(self.def_src.handle)
self.dbase.add_citation(citation, self.trans)
obj.add_citation(citation.handle)
@@ -7236,7 +7236,7 @@ class GedcomParser(UpdateCallback):
@type state: CurrentState
"""
sub_state = CurrentState(level=state.level + 1)
- sub_state.location = gen.lib.Location()
+ sub_state.location = Location()
sub_state.location.set_street(line.data)
self.__parse_level(sub_state, self.parse_loc_tbl, self.__undefined)
@@ -7429,7 +7429,7 @@ def make_gedcom_date(subdate, calendar, mode, quality):
except IndexError:
print "Month index error - %d" % mon
retval = "%d%s" % (year, bce)
- if calendar == gen.lib.Date.CAL_SWEDISH:
+ if calendar == Date.CAL_SWEDISH:
# If Swedish calendar use ISO for for date and append (swedish)
# to indicate calandar
if year and not mon and not day:
diff --git a/gramps/plugins/lib/libmetadata.py b/gramps/plugins/lib/libmetadata.py
index 307d62791..1fc08b66b 100644
--- a/gramps/plugins/lib/libmetadata.py
+++ b/gramps/plugins/lib/libmetadata.py
@@ -39,7 +39,7 @@ from gui.listmodel import ListModel
from gen.ggettext import gettext as _
from gen.utils.place import conv_lat_lon
from fractions import Fraction
-import gen.lib
+from gramps.gen.lib import Date
from gramps.gen.datehandler import displayer
import datetime
import pyexiv2
@@ -58,7 +58,7 @@ def format_datetime(exif_dt):
"""
if type(exif_dt) != datetime.datetime:
return _('Invalid format')
- date_part = gen.lib.Date()
+ date_part = Date()
date_part.set_yr_mon_day(exif_dt.year, exif_dt.month, exif_dt.day)
date_str = displayer.display(date_part)
time_str = _('%(hr)02d:%(min)02d:%(sec)02d') % {'hr': exif_dt.hour,
diff --git a/gramps/plugins/lib/libpersonview.py b/gramps/plugins/lib/libpersonview.py
index d49a96b6e..c476cde47 100644
--- a/gramps/plugins/lib/libpersonview.py
+++ b/gramps/plugins/lib/libpersonview.py
@@ -47,7 +47,7 @@ _LOG = logging.getLogger(".gui.personview")
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person, Surname
from gen.db import DbTxn
from gui.views.listview import ListView
from gen.utils.string import data_recover_msg
@@ -260,9 +260,9 @@ class BasePersonView(ListView):
"""
Add a new person to the database.
"""
- person = gen.lib.Person()
+ person = Person()
#the editor requires a surname
- person.primary_name.add_surname(gen.lib.Surname())
+ person.primary_name.add_surname(Surname())
person.primary_name.set_primary_surname(0)
try:
diff --git a/gramps/plugins/lib/libplaceview.py b/gramps/plugins/lib/libplaceview.py
index 9a3dad9ab..0d496c318 100644
--- a/gramps/plugins/lib/libplaceview.py
+++ b/gramps/plugins/lib/libplaceview.py
@@ -46,7 +46,7 @@ from gi.repository import Gtk
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Place
from gui.views.listview import ListView
from gui.widgets.menuitem import add_menuitem
from gen.errors import WindowActiveError
@@ -361,7 +361,7 @@ class PlaceBaseView(ListView):
def add(self, obj):
try:
- EditPlace(self.dbstate, self.uistate, [], gen.lib.Place())
+ EditPlace(self.dbstate, self.uistate, [], Place())
except WindowActiveError:
pass
diff --git a/gramps/plugins/lib/libsubstkeyword.py b/gramps/plugins/lib/libsubstkeyword.py
index 508e7f7fb..74d343d0f 100644
--- a/gramps/plugins/lib/libsubstkeyword.py
+++ b/gramps/plugins/lib/libsubstkeyword.py
@@ -39,7 +39,7 @@ Mary Smith was born on 3/28/1923.
#------------------------------------------------------------------------
from gen.display.name import displayer as name_displayer
from gramps.gen.datehandler import displayer
-import gen.lib
+from gramps.gen.lib import EventType
from gen.utils.db import get_birth_or_fallback, get_death_or_fallback
#------------------------------------------------------------------------
@@ -868,14 +868,14 @@ class VariableParse(object):
return
return self.__parse_date(
self.get_event_by_type(self.friend.family,
- gen.lib.EventType.MARRIAGE))
+ EventType.MARRIAGE))
elif next_char == "v":
#Divorce date
if self.empty_item(self.friend.family):
return
return self.__parse_date(
self.get_event_by_type(self.friend.family,
- gen.lib.EventType.DIVORCE))
+ EventType.DIVORCE))
elif next_char == "T":
#Todays date
date_f = DateFormat(self._in)
@@ -903,14 +903,14 @@ class VariableParse(object):
return
return self.__parse_place(
self.get_event_by_type(self.friend.family,
- gen.lib.EventType.MARRIAGE))
+ EventType.MARRIAGE))
elif next_char == "V":
#Divorce place
if self.empty_item(self.friend.family):
return
return self.__parse_place(
self.get_event_by_type(self.friend.family,
- gen.lib.EventType.DIVORCE))
+ EventType.DIVORCE))
elif next_char == "a":
#Person's Atribute
diff --git a/gramps/plugins/lib/maps/constants.py b/gramps/plugins/lib/maps/constants.py
index 131023e87..0c95e8a9b 100644
--- a/gramps/plugins/lib/maps/constants.py
+++ b/gramps/plugins/lib/maps/constants.py
@@ -27,7 +27,7 @@
# standard python modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventType
import os
from gen.const import HOME_DIR
from gi.repository import OsmGpsMap as osmgpsmap
@@ -40,9 +40,9 @@ from gi.repository import OsmGpsMap as osmgpsmap
GEOGRAPHY_PATH = os.path.join(HOME_DIR, "maps")
ICONS = {
- gen.lib.EventType.BIRTH : 'gramps-geo-birth',
- gen.lib.EventType.DEATH : 'gramps-geo-death',
- gen.lib.EventType.MARRIAGE : 'gramps-geo-marriage',
+ EventType.BIRTH : 'gramps-geo-birth',
+ EventType.DEATH : 'gramps-geo-death',
+ EventType.MARRIAGE : 'gramps-geo-marriage',
}
# map providers
diff --git a/gramps/plugins/lib/maps/geography.py b/gramps/plugins/lib/maps/geography.py
index 53b5340f1..8900becb1 100644
--- a/gramps/plugins/lib/maps/geography.py
+++ b/gramps/plugins/lib/maps/geography.py
@@ -49,7 +49,7 @@ import cairo
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventType, Place
from gen.display.name import displayer as _nd
from gui.views.navigationview import NavigationView
from gen.utils.libformatting import FormattingHelper
@@ -164,9 +164,9 @@ class GeoGraphyView(OsmGps, NavigationView):
else:
default_image = self.geo_altmap
self.geo_othermap = {}
- for ident in ( gen.lib.EventType.BIRTH,
- gen.lib.EventType.DEATH,
- gen.lib.EventType.MARRIAGE ):
+ for ident in ( EventType.BIRTH,
+ EventType.DEATH,
+ EventType.MARRIAGE ):
path = os.path.join(ROOT_DIR, "images", "48x48",
(constants.ICONS.get(int(ident), default_image) + '.png' ))
pathu = path.encode(sys.getfilesystemencoding())
@@ -864,7 +864,7 @@ class GeoGraphyView(OsmGps, NavigationView):
on the map
"""
self.select_fct.close()
- new_place = gen.lib.Place()
+ new_place = Place()
new_place.set_latitude(str(plat))
new_place.set_longitude(str(plon))
loc = new_place.get_main_location()
diff --git a/gramps/plugins/quickview/lineage.py b/gramps/plugins/quickview/lineage.py
index 954ef235a..879270d5b 100644
--- a/gramps/plugins/quickview/lineage.py
+++ b/gramps/plugins/quickview/lineage.py
@@ -32,7 +32,7 @@ Display a person's father or mother lineage
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import ChildRefType, Person
from gen.simple import SimpleAccess, SimpleDoc
from gui.plug.quick import QuickTable
from gen.ggettext import gettext as _
@@ -60,17 +60,17 @@ def run_father(database, document, person):
sd.paragraph("")
stab = QuickTable(sa)
stab.columns(_("Name Father"), _("Birth Date"), _("Death Date"), _("Remark"))
- make_details(gen.lib.Person.MALE, person, sa, sd, database, stab)
+ make_details(Person.MALE, person, sa, sd, database, stab)
stab.write(sd)
sd.paragraph("")
- if person.gender == gen.lib.Person.FEMALE :
+ if person.gender == Person.FEMALE :
return
sd.header2((_("Direct line male descendants")))
sd.paragraph("")
- make_details_child(gen.lib.Person.MALE, person, sa, sd, database)
+ make_details_child(Person.MALE, person, sa, sd, database)
def run_mother(database, document, person):
""" Function writing the mother lineage quick report
@@ -92,17 +92,17 @@ def run_mother(database, document, person):
stab = QuickTable(sa)
stab.columns(_("Name Mother"), _("Birth"), _("Death Date"), _("Remark"))
- make_details(gen.lib.Person.FEMALE, person, sa, sd, database, stab)
+ make_details(Person.FEMALE, person, sa, sd, database, stab)
stab.write(sd)
sd.paragraph("")
- if person.gender == gen.lib.Person.MALE :
+ if person.gender == Person.MALE :
return
sd.header2((_("Direct line female descendants")))
sd.paragraph("")
- make_details_child(gen.lib.Person.FEMALE, person, sa, sd, database)
+ make_details_child(Person.FEMALE, person, sa, sd, database)
def make_details(gender, person, sa, sd, database, stab) :
""" Function writing one line of ancestry on the document in
@@ -138,7 +138,7 @@ def make_details(gender, person, sa, sd, database, stab) :
ref.get_father_relation()) for ref in
family.get_child_ref_list()
if ref.ref == person_handle]
- if gender == gen.lib.Person.MALE :
+ if gender == Person.MALE :
person = database.get_person_from_handle(
family.get_father_handle())
refnr = 1
@@ -151,11 +151,11 @@ def make_details(gender, person, sa, sd, database, stab) :
# that would complicate the code
#Also, we assume the birth relation is in the FIRST
# family of the person, so we go up on non-birth
- if not childrel[0][refnr] == gen.lib.ChildRefType.BIRTH :
+ if not childrel[0][refnr] == ChildRefType.BIRTH :
rem_str = add_rem(rem_str, _("No birth relation with child"))
if person and person.gender == gender :
break
- elif person and person.gender == gen.lib.Person.UNKNOWN :
+ elif person and person.gender == Person.UNKNOWN :
rem_str = add_rem(rem_str, _("Unknown gender"))
break
else :
@@ -175,7 +175,7 @@ def make_details_child(gender, person, sa, sd, database) :
raise RuntimeError
#we use some global var from make_details_child !
rem_str = ""
- if child.gender == gen.lib.Person.UNKNOWN :
+ if child.gender == Person.UNKNOWN :
rem_str = add_rem(rem_str, _("Unknown gender"))
if rem_str :
@@ -204,7 +204,7 @@ def make_details_child(gender, person, sa, sd, database) :
fam.get_child_ref_list()]
for childdet in childrel:
#relation with parent must be by birth
- if not childdet[childrelnr] == gen.lib.ChildRefType.BIRTH :
+ if not childdet[childrelnr] == ChildRefType.BIRTH :
continue
newchild = database.get_person_from_handle(childdet[0])
diff --git a/gramps/plugins/quickview/onthisday.py b/gramps/plugins/quickview/onthisday.py
index 0e2fb2e13..cf9563719 100644
--- a/gramps/plugins/quickview/onthisday.py
+++ b/gramps/plugins/quickview/onthisday.py
@@ -29,7 +29,7 @@ Display all events on a particular day.
from gen.simple import SimpleAccess, SimpleDoc, SimpleTable
from gui.plug.quick import QuickTable
from gen.ggettext import gettext as _
-import gen.lib
+from gramps.gen.lib import Date
def get_ref(db, objclass, handle):
"""
@@ -57,7 +57,7 @@ def run(database, document, main_event):
Takes an Event or Date object
"""
- if isinstance(main_event, gen.lib.Date):
+ if isinstance(main_event, Date):
main_date = main_event
else:
main_date = main_event.get_date_object()
diff --git a/gramps/plugins/quickview/samesurnames.py b/gramps/plugins/quickview/samesurnames.py
index d570b7387..4f5c6c91d 100644
--- a/gramps/plugins/quickview/samesurnames.py
+++ b/gramps/plugins/quickview/samesurnames.py
@@ -31,7 +31,7 @@ from gen.simple import SimpleAccess, SimpleDoc
from gui.plug.quick import QuickTable
from gen.ggettext import gettext as _
from gen.ggettext import ngettext
-import gen.lib
+from gramps.gen.lib import Person
from gen.filters.rules import Rule
from gen.filters import GenericFilterFactory
@@ -97,7 +97,7 @@ def run(database, document, person):
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
- if isinstance(person, gen.lib.Person):
+ if isinstance(person, Person):
surname = sdb.surname(person)
rsurname = person.get_primary_name().get_group_name()
else:
@@ -139,7 +139,7 @@ def run_given(database, document, person):
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
- if isinstance(person, gen.lib.Person):
+ if isinstance(person, Person):
rgivenname = person.get_primary_name().get_first_name()
else:
rgivenname = person
diff --git a/gramps/plugins/rel/rel_ca.py b/gramps/plugins/rel/rel_ca.py
index dc064276a..29502446f 100644
--- a/gramps/plugins/rel/rel_ca.py
+++ b/gramps/plugins/rel/rel_ca.py
@@ -38,7 +38,7 @@ not explicitly in the dictionary, but "netastre" is.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -927,7 +927,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if Gb == 0:
rel_str = u"la mateixa persona"
- elif gender_b == gen.lib.Person.MALE:
+ elif gender_b == Person.MALE:
# spouse of daughter
@@ -935,7 +935,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = u"el gendre"
else:
rel_str = _get_son(Gb, inlaw, step)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
# spouse of son
@@ -949,7 +949,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# b is parents/grand parent of a
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
# father of spouse (family of spouse)
if Ga == 1 and inlaw and not step:
@@ -957,7 +957,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
else:
rel_str = _get_father(Ga, inlaw, step)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
# mother of spouse (family of spouse)
if Ga == 1 and inlaw and not step:
@@ -972,16 +972,16 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# b is sibling/aunt/uncle of a
if inlaw and Ga == 1 and not step:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "el cunyat"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "la cunyada"
- else: # gender_b == gen.lib.Person.UNKNOWN:
+ else: # gender_b == Person.UNKNOWN:
rel_str = "un cunyat"
- elif gender_b == gen.lib.Person.MALE :
+ elif gender_b == Person.MALE :
rel_str = _get_uncle(Ga, inlaw, step)
- elif gender_b == gen.lib.Person.FEMALE :
+ elif gender_b == Person.FEMALE :
rel_str = _get_aunt(Ga, inlaw, step)
else:
rel_str = _get_sibling_unknown(Ga, inlaw, step)
@@ -990,11 +990,11 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# b is niece/nephew of a
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = _get_nephew(Gb - 1, inlaw, step)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = _get_niece(Gb - 1, inlaw, step)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = _get_nephew_unk(Gb - 1, inlaw, step)
else:
# This should never get executed
@@ -1003,11 +1003,11 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# a and b cousins in the same generation
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = _get_cosi(Ga - 1, inlaw, step)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = _get_cosina(Ga - 1, inlaw, step)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = _get_cosi_unknown(Ga-1, inlaw, step)
else:
rel_str = "error in get_single_relationship_string()"
@@ -1017,9 +1017,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# being in a higher generation from the common ancestor than the
# first person.
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = _get_oncle_valencia(Ga, Gb, inlaw, step)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = _get_tia_valenciana(Ga, Gb, inlaw, step)
else:
rel_str = _get_oncle_valencia(Ga, Gb, inlaw, step)
@@ -1028,9 +1028,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# These are cousins in different generations with the second person
# being in a lower generation from the common ancestor than the
# first person.
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = _get_nebot_valencia(Ga, Gb, inlaw, step)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = _get_neboda_valenciana(Ga, Gb, inlaw, step)
else:
rel_str = _get_nebot_valencia(Ga, Gb, inlaw, step)
@@ -1052,31 +1052,31 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if sib_type == self.NORM_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"el germà"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la germana"
else:
rel_str = u"el germà o germana"
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"el cunyat"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la cunyada"
else:
rel_str = u"el cunyat o la cunyada"
elif sib_type == self.UNKNOWN_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"el germà"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la germana"
else:
rel_str = u"el germà o germana"
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"el cunyat"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la cunyada"
else:
rel_str = u"el cunyat o la cunyada"
@@ -1086,16 +1086,16 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"el germanastre"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la germanastra"
else:
rel_str = u"el germanastre o la germanastra"
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"el cunyat"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la cunyada"
else:
rel_str = u"el cunyat o la cunyada"
diff --git a/gramps/plugins/rel/rel_cs.py b/gramps/plugins/rel/rel_cs.py
index 16bbbe243..feec0e585 100644
--- a/gramps/plugins/rel/rel_cs.py
+++ b/gramps/plugins/rel/rel_cs.py
@@ -33,7 +33,7 @@ Czech-specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -159,42 +159,42 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if firstRel == 0:
if secondRel == 0:
return ('', common)
- elif other_person_gender == gen.lib.Person.MALE:
+ elif other_person_gender == Person.MALE:
return (self.get_father(secondRel), common)
else:
return (self.get_mother(secondRel), common)
elif secondRel == 0:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_son(firstRel), common)
else:
return (self.get_daughter(firstRel), common)
elif firstRel == 1:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_uncle(secondRel), common)
else:
return (self.get_aunt(secondRel), common)
elif secondRel == 1:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_nephew(firstRel-1), common)
else:
return (self.get_niece(firstRel-1), common)
elif firstRel == secondRel == 2:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return ('vlastní bratranec', common)
else:
return ('vlastní sestřenice', common)
elif firstRel == 3 and secondRel == 2:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return ('bratranec druhého stupně', common)
else:
return ('sestřenice druhého stupně', common)
elif firstRel == 2 and secondRel == 3:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return ('bratranec druhého stupně', common)
else:
return ('sestřenice druhého stupně', common)
else:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
if firstRel+secondRel > len(_level_name)-1:
return (self.get_male_cousin(firstRel+secondRel), common)
else:
diff --git a/gramps/plugins/rel/rel_da.py b/gramps/plugins/rel/rel_da.py
index 29f95c8e2..439080463 100644
--- a/gramps/plugins/rel/rel_da.py
+++ b/gramps/plugins/rel/rel_da.py
@@ -34,7 +34,7 @@ Specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -129,7 +129,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('sønne')
else:
result.append('datter')
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('søn')
else:
result.append('datter')
@@ -152,12 +152,12 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('sønne')
else:
result.append('datter')
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('søn')
else:
result.append('datter')
else:
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('bror')
else:
result.append('søster')
diff --git a/gramps/plugins/rel/rel_de.py b/gramps/plugins/rel/rel_de.py
index 1492578a3..b91285806 100644
--- a/gramps/plugins/rel/rel_de.py
+++ b/gramps/plugins/rel/rel_de.py
@@ -46,7 +46,7 @@ import re
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -170,9 +170,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
return u' %d. Grades' % degree
def _gender_convert(self, gender):
- if gender == gen.lib.Person.MALE:
+ if gender == Person.MALE:
return 'male'
- elif gender == gen.lib.Person.FEMALE:
+ elif gender == Person.FEMALE:
return 'female'
else:
return 'unknown'
diff --git a/gramps/plugins/rel/rel_es.py b/gramps/plugins/rel/rel_es.py
index e269b3d3a..393bfb4de 100644
--- a/gramps/plugins/rel/rel_es.py
+++ b/gramps/plugins/rel/rel_es.py
@@ -32,10 +32,10 @@ Spanish-specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
-MALE = gen.lib.Person.MALE
-FEMALE = gen.lib.Person.FEMALE
-UNKNOWN = gen.lib.Person.UNKNOWN
+from gramps.gen.lib import Person
+MALE = Person.MALE
+FEMALE = Person.FEMALE
+UNKNOWN = Person.UNKNOWN
import gen.relationship
#-------------------------------------------------------------------------
@@ -705,17 +705,17 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = "%s o %s" % (self._get_male_cousin(Ga-1, 0, step=step, inlaw=inlaw),
self._get_female_cousin(Ga-1, 0, step=step, inlaw=inlaw))
elif Ga == Gb+1:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self._get_distant_uncle(Gb, step, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = self._get_distant_aunt(Gb, step, inlaw)
else:
rel_str = "%s o %s" % (self._get_distant_uncle(Gb, 0, step=step, inlaw=inlaw),
self._get_distant_aunt(Gb, 0, step=step, inlaw=inlaw))
elif Ga+1 == Gb:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self._get_distant_nephew(Gb-1, step, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = self._get_distant_niece(Gb-1, step, inlaw)
else:
rel_str = "%s o %s" % (self._get_distant_nephew(Gb-1, 0, step=step, inlaw=inlaw),
diff --git a/gramps/plugins/rel/rel_fi.py b/gramps/plugins/rel/rel_fi.py
index 5c477e83b..d76bec97c 100644
--- a/gramps/plugins/rel/rel_fi.py
+++ b/gramps/plugins/rel/rel_fi.py
@@ -34,7 +34,7 @@ Specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -92,7 +92,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('isän')
else:
result.append('äidin')
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('isä')
else:
result.append('äiti')
@@ -107,9 +107,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('tyttären')
else:
result.append('lapsen')
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('poika')
- elif person == gen.lib.Person.FEMALE:
+ elif person == Person.FEMALE:
result.append('tytär')
else:
result.append('lapsi')
@@ -144,9 +144,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('tyttären')
else:
result.append('lapsen')
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('poika')
- elif person == gen.lib.Person.FEMALE:
+ elif person == Person.FEMALE:
result.append('tytär')
else:
result.append('lapsi')
@@ -185,7 +185,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
elif not secondRel:
return (self.get_direct_descendant(other_person, firstRel), common)
elif len(firstRel) == 1:
- if other_person == gen.lib.Person.MALE:
+ if other_person == Person.MALE:
return (self.get_ancestors_brother(secondRel), common)
else:
return (self.get_ancestors_sister(secondRel), common)
@@ -202,7 +202,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
def get_sibling_relationship_string(self, sib_type, gender_a, gender_b,
in_law_a=False, in_law_b=False):
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
return self.get_ancestors_brother("")
else:
return self.get_ancestors_sister("")
diff --git a/gramps/plugins/rel/rel_fr.py b/gramps/plugins/rel/rel_fr.py
index 77345926f..da58d0c99 100644
--- a/gramps/plugins/rel/rel_fr.py
+++ b/gramps/plugins/rel/rel_fr.py
@@ -32,7 +32,7 @@ French-specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -572,7 +572,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if Gb == 0:
rel_str = u"le même individu"
- elif gender_b == gen.lib.Person.MALE and Gb < len(_SON_LEVEL):
+ elif gender_b == Person.MALE and Gb < len(_SON_LEVEL):
# spouse of daughter
@@ -580,7 +580,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = u"le gendre"
else:
rel_str = get_son(Gb)
- elif gender_b == gen.lib.Person.FEMALE and Gb < len(_DAUGHTER_LEVEL):
+ elif gender_b == Person.FEMALE and Gb < len(_DAUGHTER_LEVEL):
# spouse of son
@@ -588,13 +588,13 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = u"la bru"
else:
rel_str = get_daughter(Gb)
- elif Gb < len(_LEVEL_NAME) and gender_b == gen.lib.Person.MALE:
+ elif Gb < len(_LEVEL_NAME) and gender_b == Person.MALE:
# don't display inlaw
rel_str = u"le descendant lointain (%dème génération)" % \
(Gb + 1)
- elif Gb < len(_LEVEL_NAME) and gender_b == gen.lib.Person.FEMALE:
+ elif Gb < len(_LEVEL_NAME) and gender_b == Person.FEMALE:
rel_str = u"la descendante lointaine (%dème génération)" % \
(Gb + 1)
else:
@@ -603,7 +603,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# b is parents/grand parent of a
- if gender_b == gen.lib.Person.MALE and Ga < len(_FATHER_LEVEL):
+ if gender_b == Person.MALE and Ga < len(_FATHER_LEVEL):
# other spouse of father (new parent)
@@ -616,7 +616,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = u"le père du conjoint"
else:
rel_str = get_father(Ga, inlaw)
- elif gender_b == gen.lib.Person.FEMALE and Ga < len(_MOTHER_LEVEL):
+ elif gender_b == Person.FEMALE and Ga < len(_MOTHER_LEVEL):
# other spouse of mother (new parent)
@@ -629,10 +629,10 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = u"la mère du conjoint"
else:
rel_str = get_mother(Ga, inlaw)
- elif Ga < len(_LEVEL_NAME) and gender_b == gen.lib.Person.MALE:
+ elif Ga < len(_LEVEL_NAME) and gender_b == Person.MALE:
rel_str = u"l'ascendant lointain%s (%dème génération)" % \
(inlaw, Ga + 1)
- elif Ga < len(_LEVEL_NAME) and gender_b == gen.lib.Person.FEMALE:
+ elif Ga < len(_LEVEL_NAME) and gender_b == Person.FEMALE:
rel_str = u"l'ascendante lointaine%s (%dème génération)" % \
(inlaw, Ga + 1)
else:
@@ -641,19 +641,19 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# b is sibling/aunt/uncle of a
- if gender_b == gen.lib.Person.MALE and Ga < len(_BROTHER_LEVEL):
+ if gender_b == Person.MALE and Ga < len(_BROTHER_LEVEL):
rel_str = get_uncle(Ga, inlaw)
- elif gender_b == gen.lib.Person.FEMALE and Ga < len(_SISTER_LEVEL):
+ elif gender_b == Person.FEMALE and Ga < len(_SISTER_LEVEL):
rel_str = get_aunt(Ga, inlaw)
else:
# don't display inlaw
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"l'oncle lointain" + bygen % (Ga + 1)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la tante lointaine" + bygen % (Ga + 1)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = get_sibling_unknown(inlaw)
else:
return rel_str
@@ -661,18 +661,18 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# b is niece/nephew of a
- if gender_b == gen.lib.Person.MALE and Gb < len(_NEPHEW_LEVEL):
+ if gender_b == Person.MALE and Gb < len(_NEPHEW_LEVEL):
rel_str = get_nephew(Gb - 1, inlaw)
- elif gender_b == gen.lib.Person.FEMALE and Gb < len(_NIECE_LEVEL):
+ elif gender_b == Person.FEMALE and Gb < len(_NIECE_LEVEL):
rel_str = get_niece(Gb - 1, inlaw)
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le neveu lointain%s (%dème génération)" % \
(inlaw, Gb)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la nièce lointaine%s (%dème génération)" % \
(inlaw, Gb)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = get_sibling_unknown(inlaw)
else:
return rel_str
@@ -680,11 +680,11 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# a and b cousins in the same generation
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = get_cousin(Ga - 1, 0, inlaw=inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = get_cousine(Ga - 1, 0, inlaw=inlaw)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = get_sibling_unknown(inlaw)
else:
return rel_str
@@ -695,13 +695,13 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# first person.
if Ga == 3 and Gb == 2:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
desc = u" (cousin germain d'un parent)"
rel_str = u"l'oncle à la mode de Bretagne" + desc
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
desc = u" (cousine germaine d'un parent)"
rel_str = u"la tante à la mode de Bretagne" + desc
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
return get_sibling_unknown(Ga, inlaw)
else:
return rel_str
@@ -711,20 +711,20 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
_REMOVED_LEVEL[Ga])
civ = u" et au %s degré (civil)" % _REMOVED_LEVEL[Ga + Gb +
1]
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"l'oncle" + can + civ
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la tante" + can + civ
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = get_sibling_unknown(Ga, inlaw)
else:
return rel_str
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = get_uncle(Ga, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = get_aunt(Ga, inlaw)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = get_sibling_unknown(Ga, inlaw)
else:
return rel_str
@@ -736,11 +736,11 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if Ga == 2 and Gb == 3:
info = u" (cousins issus d'un germain)"
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le neveu à la mode de Bretagne" + info
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la nièce à la mode de Bretagne" + info
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = get_sibling_unknown(Ga, inlaw)
else:
return rel_str
@@ -750,22 +750,22 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
_REMOVED_LEVEL[Ga])
civ = u" et au %s degré (civil)" % _REMOVED_LEVEL[Ga + Gb +
1]
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le neveu" + can + civ
- if gender_b == gen.lib.Person.FEMALE:
+ if gender_b == Person.FEMALE:
rel_str = u"la nièce" + can + civ
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = get_sibling_unknown(Ga, inlaw)
else:
return rel_str
elif Ga > len(_LEVEL_NAME):
return rel_str
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = get_nephew(Ga, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = get_niece(Ga, inlaw)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = get_sibling_unknown(Ga, inlaw)
else:
return rel_str
@@ -786,31 +786,31 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if sib_type == self.NORM_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le frère (germain)"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la sœur (germaine)"
else:
rel_str = u"le frère ou la sœur germain(e)"
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le beau-frère"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la belle-sœur"
else:
rel_str = u"le beau-frère ou la belle-sœur"
elif sib_type == self.UNKNOWN_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le frère"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la sœur"
else:
rel_str = u"le frère ou la sœur"
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le beau-frère"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la belle-sœur"
else:
rel_str = u"le beau-frère ou la belle-sœur"
@@ -818,9 +818,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# for descendants the "half" logic is reversed !
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le demi-frère consanguin"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la demi-sœur consanguine"
else:
rel_str = u"le demi-frère ou la demi-sœur consanguin(e)"
@@ -828,16 +828,16 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# for descendants the "half" logic is reversed !
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le demi-frère utérin"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la demi-sœur utérine"
else:
rel_str = u"le demi-frère ou la demi-sœur utérin(e)"
elif sib_type == self.STEP_SIB:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = u"le demi-frère"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = u"la demi-sœur"
else:
rel_str = u"le demi-frère ou la demi-sœur"
diff --git a/gramps/plugins/rel/rel_hu.py b/gramps/plugins/rel/rel_hu.py
index 4ad3f6b49..6128f7e91 100644
--- a/gramps/plugins/rel/rel_hu.py
+++ b/gramps/plugins/rel/rel_hu.py
@@ -34,7 +34,7 @@ Specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -214,25 +214,25 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if in_law_a or in_law_a:
if firstRel == 0 and secondRel == 0:
- if other_person == gen.lib.Person.MALE:
+ if other_person == Person.MALE:
return ("apósa","")
- elif other_person == gen.lib.Person.FEMALE:
+ elif other_person == Person.FEMALE:
return ("anyósa","")
else:
return ("apósa vagy anyósa","")
elif secondRel == 0:
- if orig_person == gen.lib.Person.MALE:
+ if orig_person == Person.MALE:
return ("veje","")
- elif orig_person == gen.lib.Person.FEMALE:
+ elif orig_person == Person.FEMALE:
return ("menye","")
else:
return ("veje vagy menye","")
elif firstRel == 1:
- if other_person == gen.lib.Person.MALE:
+ if other_person == Person.MALE:
return ("sógora","")
- elif other_person == gen.lib.Person.FEMALE:
+ elif other_person == Person.FEMALE:
return ("sógornője","")
else:
return ("sógora vagy sógornője","")
@@ -240,19 +240,19 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if firstRel == 0:
if secondRel == 0:
return ('', common)
- elif other_person == gen.lib.Person.MALE:
+ elif other_person == Person.MALE:
return (self.get_father(secondRel), common)
else:
return (self.get_mother(secondRel), common)
elif secondRel == 0:
- if other_person == gen.lib.Person.MALE:
+ if other_person == Person.MALE:
return (self.get_son(firstRel), common)
else:
return (self.get_daughter(firstRel), common)
elif firstRel == 1:
- if other_person == gen.lib.Person.MALE:
+ if other_person == Person.MALE:
if secondRel == 1:
return (self.get_age_brother(self.get_age_comp(orig_person, other_person)), common)
else :return (self.get_uncle(secondRel), common)
@@ -262,13 +262,13 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
else :return (self.get_aunt(secondRel), common)
elif secondRel == 1:
- if other_person == gen.lib.Person.MALE:
+ if other_person == Person.MALE:
return (self.get_nephew(firstRel-1), common)
else:
return (self.get_niece(firstRel-1), common)
else:
- if other_person == gen.lib.Person.MALE:
+ if other_person == Person.MALE:
return (self.get_male_cousin(firstRel-1), common)
else:
return (self.get_female_cousin(firstRel-1), common)
diff --git a/gramps/plugins/rel/rel_it.py b/gramps/plugins/rel/rel_it.py
index e9545e989..a1f740fe9 100644
--- a/gramps/plugins/rel/rel_it.py
+++ b/gramps/plugins/rel/rel_it.py
@@ -37,7 +37,7 @@ Italian-Specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -146,7 +146,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
#-------------------------------------------------------------------------
def __gen_suffix(self, gender):
- if gender == gen.lib.Person.MALE:
+ if gender == Person.MALE:
return 'o'
return 'a'
@@ -350,27 +350,27 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if firstRel == 0:
if secondRel == 0:
return ('', common)
- elif other_person.get_gender() == gen.lib.Person.MALE:
+ elif other_person.get_gender() == Person.MALE:
return (self.get_father(secondRel), common)
else:
return (self.get_mother(secondRel), common)
elif secondRel == 0:
- if other_person.get_gender() == gen.lib.Person.MALE:
+ if other_person.get_gender() == Person.MALE:
return (self.get_son(firstRel), common)
else:
return (self.get_daughter(firstRel), common)
elif firstRel == 1:
- if other_person.get_gender() == gen.lib.Person.MALE:
+ if other_person.get_gender() == Person.MALE:
return (self.get_uncle(secondRel), common)
else:
return (self.get_aunt(secondRel), common)
elif secondRel == 1:
- if other_person.get_gender() == gen.lib.Person.MALE:
+ if other_person.get_gender() == Person.MALE:
return (self.get_nephew(firstRel-1), common)
else:
return (self.get_niece(firstRel-1), common)
else:
- if other_person.get_gender() == gen.lib.Person.MALE:
+ if other_person.get_gender() == Person.MALE:
return (self.get_male_cousin(firstRel-1, secondRel-1), common)
else:
return (self.get_female_cousin(firstRel-1, secondRel-1), common)
@@ -393,9 +393,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
else:
inlaw = ''
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "un parente%s%s lontano" % (step, inlaw) % {'gen': 'o'}
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "una parente%s%s lontana" % (step, inlaw) % {'gen': 'a'}
else:
rel_str = "uno dei parenti%s%s lontani" % (step, inlaw) % {'gen': 'i'}
@@ -404,56 +404,56 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if Ga == 0:
rel_str = 'la stessa persona'
elif Ga == 1 and inlaw and not step:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'il suocero'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'la suocera'
else:
rel_str = 'uno dei suoceri'
elif Ga == 1 and not inlaw and step:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'il patrigno'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'la matrigna'
else:
rel_str = 'uno dei genitori adottivi'
- elif gender_b == gen.lib.Person.MALE:
+ elif gender_b == Person.MALE:
rel_str = self.get_father(Ga, step, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = self.get_mother(Ga, step, inlaw)
else:
rel_str = self.get_parent_unknown(Ga, step, inlaw)
elif Ga == 0:
if Gb == 1 and inlaw and not step:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'il genero'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'la nuora'
else:
rel_str = 'genero/nuora'
- elif gender_b == gen.lib.Person.MALE:
+ elif gender_b == Person.MALE:
rel_str = self.get_son(Gb, step, inlaw)
else:
rel_str = self.get_daughter(Gb, step, inlaw)
elif Gb == 1:
if Ga == 1 and inlaw and not step:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'il cognato'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'la cognata'
else:
rel_str = 'il cognato/a'
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self.get_uncle(Ga, step, inlaw)
else:
rel_str = self.get_aunt(Ga, step, inlaw)
elif Ga == 1:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self.get_nephew(Gb-1, step, inlaw)
else:
rel_str = self.get_niece(Gb-1, step, inlaw)
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self.get_male_cousin(Gb-1, Ga-1, step, inlaw)
else:
rel_str = self.get_female_cousin(Gb-1, Ga-1, step, inlaw)
@@ -476,14 +476,14 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if sib_type == self.NORM_SIB or sib_type == self.UNKNOWN_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self.get_uncle(1, '', '')
else:
rel_str = self.get_aunt(1, '', '')
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'il cognato'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'la cognata'
else:
rel_str = 'il cognato/a'
@@ -492,16 +492,16 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
or sib_type == self.STEP_SIB:
#Italian has no difference between half and step sibling!
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'il fratellastro'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'la sorellastra'
else:
rel_str = 'il fratellastro/sorellastra'
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'il fratellastro acquisito'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'la sorellastra acquisita'
else:
rel_str = 'il fratellastro/sorellastra acquisito/a'
diff --git a/gramps/plugins/rel/rel_nl.py b/gramps/plugins/rel/rel_nl.py
index d23d793d3..b6cfbe9b2 100644
--- a/gramps/plugins/rel/rel_nl.py
+++ b/gramps/plugins/rel/rel_nl.py
@@ -30,7 +30,7 @@ Specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -447,58 +447,58 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if Ga == 0:
rel_str = 'zelfde persoon'
elif Ga == 1 and inlaw and not step:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'schoonvader'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'schoonmoeder'
else:
rel_str = 'schoonouder'
- elif gender_b == gen.lib.Person.MALE:
+ elif gender_b == Person.MALE:
rel_str = self._get_father(Ga, step, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = self._get_mother(Ga, step, inlaw)
else:
rel_str = self._get_parent_unknown(Ga, step, inlaw)
elif Ga == 0:
#a is descendant
if Gb == 1 and inlaw and not step:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'schoonzoon'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'schoondochter'
else:
rel_str = 'schoonzoon of -dochter'
elif Gb == 1 and inlaw and step:
#inlaw stepchild
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'aangetrouwde stiefzoon'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'aangetrouwde stiefdochter'
else:
rel_str = 'aangetrouwde stiefzoon of dochter'
- elif gender_b == gen.lib.Person.MALE:
+ elif gender_b == Person.MALE:
rel_str = self._get_son(Gb, step, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = self._get_daughter(Gb, step, inlaw)
else:
rel_str = self._get_child_unknown(Gb, step, inlaw)
elif Ga > Gb:
#b is higher in the branch, in english uncle/aunt or
#cousin up, in dutch always 'oom/tante'
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self._get_uncle(Ga - Gb, Gb, step, inlaw)
else:
rel_str = self._get_aunt(Ga - Gb, Gb, step, inlaw)
elif Ga < Gb:
#b is lower in the branch, in english niece/nephew or
#cousin down, in dutch always 'neef/nicht'
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self._get_nephew(Gb - Ga, Ga, step, inlaw)
else:
rel_str = self._get_niece(Gb - Ga, Ga, step, inlaw)
else:
# people on the same level Ga == Gb
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self._get_male_cousin(Ga, step, inlaw)
else:
rel_str = self._get_female_cousin(Ga, step, inlaw)
@@ -529,14 +529,14 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
inlaw = ''
if inlaw and not typestr:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'schoonbroer'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'schoonzus'
else:
rel_str = 'schoonzus/broer'
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self._get_male_cousin(1, typestr, inlaw)
else:
rel_str = self._get_female_cousin(1, typestr, inlaw)
diff --git a/gramps/plugins/rel/rel_no.py b/gramps/plugins/rel/rel_no.py
index 30318fb1a..5f1217f91 100644
--- a/gramps/plugins/rel/rel_no.py
+++ b/gramps/plugins/rel/rel_no.py
@@ -34,7 +34,7 @@ Norwegian-Specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -116,7 +116,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('sønne')
else:
result.append('datter')
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('sønn')
else:
result.append('datter')
@@ -133,7 +133,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('mor')
if level > 1:
result.append(self.get_cousin(level))
- elif person == gen.lib.Person.MALE:
+ elif person == Person.MALE:
result.append('fetter')
else:
result.append('kusine')
@@ -162,7 +162,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('sønn')
else:
result.append('datter')
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('sønn')
else:
result.append('datter')
@@ -208,12 +208,12 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('sønne')
else:
result.append('datter')
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('sønn')
else:
result.append('datter')
else:
- if person == gen.lib.Person.MALE:
+ if person == Person.MALE:
result.append('bror')
else:
result.append('søster')
@@ -231,7 +231,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
elif not secondRel:
return (self.get_direct_descendant(other_person, firstRel), common)
elif len(firstRel) == 1:
- if other_person == gen.lib.Person.MALE:
+ if other_person == Person.MALE:
return (self.get_ancestors_brother(secondRel), common)
else:
return (self.get_ancestors_sister(secondRel), common)
diff --git a/gramps/plugins/rel/rel_pl.py b/gramps/plugins/rel/rel_pl.py
index cc0ef8bf2..5a4b4336d 100644
--- a/gramps/plugins/rel/rel_pl.py
+++ b/gramps/plugins/rel/rel_pl.py
@@ -37,7 +37,7 @@ Polish-specific definitions of relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -542,13 +542,13 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
elif Ga == 0:
# b is son/descendant of a
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
if inlaw and Gb == 1 and not step:
rel_str = "zięć"
else:
rel_str = self.get_son(Gb, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
if inlaw and Gb == 1 and not step:
rel_str = "synowa"
else:
@@ -561,14 +561,14 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
elif Gb == 0:
# b is parent/grand parent of a
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
if inlaw and Gb == 1 and not step:
# TODO: znaleźć odpowiedniki w zależności czy to syn/córka
rel_str = "teść"
else:
rel_str = self.get_father(Ga, reltocommon_a, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
if inlaw and Gb == 1 and not step:
# TODO: znaleźć odpowiedniki w zależności czy to syn/córka
rel_str = "teściowa"
@@ -581,13 +581,13 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
elif Ga == Gb == 1:
# rodzeństwo
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
if inlaw and not step:
rel_str = "brat przyrodni"
else:
rel_str = "brat rodzony"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
if inlaw and not step:
rel_str = "siostra przyrodnia"
else:
@@ -603,22 +603,22 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# rodzeństwo rodziców
# brat ojca, czyli stryj
- if (gender_b == gen.lib.Person.MALE) \
+ if (gender_b == Person.MALE) \
& (reltocommon_a[0] == self.REL_FATHER):
rel_str = "stryj"
# siostra ojca, czyli ciotka ???
- elif (gender_b == gen.lib.Person.FEMALE) \
+ elif (gender_b == Person.FEMALE) \
& (reltocommon_a[0] == self.REL_FATHER):
rel_str = "ciotka (tzw. stryjna)"
# brat matki, czyli wuj/wujek
- elif (gender_b == gen.lib.Person.MALE) \
+ elif (gender_b == Person.MALE) \
& (reltocommon_a[0] == self.REL_MOTHER):
rel_str = "wuj (wujek)"
# siostra matki, czyli ciotka
- elif (gender_b == gen.lib.Person.FEMALE) \
+ elif (gender_b == Person.FEMALE) \
& (reltocommon_a[0] == self.REL_MOTHER):
rel_str = "ciotka"
@@ -632,9 +632,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if (reltocommon_a[0] == self.REL_FATHER) \
& (reltocommon_a[1] == self.REL_FATHER):
- if (gender_b == gen.lib.Person.MALE):
+ if (gender_b == Person.MALE):
rel_str = "dziadek stryjeczny (tzw przestryj, stary stryj)"
- elif (gender_b == gen.lib.Person.FEMALE):
+ elif (gender_b == Person.FEMALE):
rel_str = "babcia stryjeczna"
else:
rel_str = "rodzeństwo przodka w 2 pokoleniu"
@@ -647,9 +647,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# dokładniejszych określeń dla tego typu relacji
# TODO: EN: Try to check, whether in old polish language
# are more specific word for this kind of relation
- if (gender_b == gen.lib.Person.MALE):
+ if (gender_b == Person.MALE):
rel_str = "dziadek stryjeczny (tzw przestryj, stary stryj)"
- elif (gender_b == gen.lib.Person.FEMALE):
+ elif (gender_b == Person.FEMALE):
rel_str = "babcia stryjeczna"
else:
rel_str = "rodzeństwo przodka w 2 pokoleniu"
@@ -662,9 +662,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# dokładniejszych określeń dla tego typu relacji
# TODO: EN: Try to check, whether in old polish language
# are more specific word for this kind of relation
- if (gender_b == gen.lib.Person.MALE):
+ if (gender_b == Person.MALE):
rel_str = "dziadek cioteczny (starop. prapociot)"
- elif (gender_b == gen.lib.Person.FEMALE):
+ elif (gender_b == Person.FEMALE):
rel_str = "babcia cioteczna (starop. praciota)"
else:
rel_str = "rodzeństwo przodka w 2 pokoleniu"
@@ -678,17 +678,17 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# dokładniejszych określeń dla tego typu relacji
# TODO: EN: Try to check, whether in old polish language
# are more specific word for this kind of relation
- if (gender_b == gen.lib.Person.MALE):
+ if (gender_b == Person.MALE):
rel_str = "dziadek cioteczny (starop. prapociot)"
- elif (gender_b == gen.lib.Person.FEMALE):
+ elif (gender_b == Person.FEMALE):
rel_str = "babcia cioteczna (starop. praciota)"
else:
rel_str = "rodzeństwo przodka w 2 pokoleniu"
else:
- if (gender_b == gen.lib.Person.MALE):
+ if (gender_b == Person.MALE):
rel_str = "rodzeństwo dziadka"
- elif (gender_b == gen.lib.Person.FEMALE):
+ elif (gender_b == Person.FEMALE):
rel_str = "rodzeństwo babci"
else:
rel_str = "rodzeństwo przodka w 2 pokoleniu"
@@ -696,7 +696,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
elif Ga > 3:
# pradziadkowie... (grandparents)
- if (gender_b == gen.lib.Person.MALE) \
+ if (gender_b == Person.MALE) \
& (reltocommon_a[0] == self.REL_FATHER):
if Ga >= 0 and Ga < len(_brother_level_of_male):
@@ -704,14 +704,14 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
else:
rel_str = "rodzeństwo przodka męskiego %d pokolenia" % Ga
- elif (gender_b == gen.lib.Person.FEMALE) \
+ elif (gender_b == Person.FEMALE) \
& (reltocommon_a[0] == self.REL_FATHER):
if Ga >= 0 and Ga < len(_sister_level_of_male):
rel_str = _sister_level_of_male[Ga]
else:
rel_str = "rodzeństwo przodka żeńskiego %d pokolenia" % Ga
- elif (gender_b == gen.lib.Person.MALE) \
+ elif (gender_b == Person.MALE) \
& (reltocommon_a[0] == self.REL_MOTHER):
if Ga >= 0 and Ga < len(_brother_level_of_female):
@@ -719,7 +719,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
else:
rel_str = "rodzeństwo przodka męskiego %d pokolenia" % Ga
- elif (gender_b == gen.lib.Person.FEMALE) \
+ elif (gender_b == Person.FEMALE) \
& (reltocommon_a[0] == self.REL_MOTHER):
if Ga >= 0 and Ga < len(_sister_level_of_female):
rel_str = _sister_level_of_male[Ga]
@@ -735,7 +735,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
elif Ga ==1 and Gb > 1:
# syn brata
- if (gender_b == gen.lib.Person.MALE) \
+ if (gender_b == Person.MALE) \
& (reltocommon_b[0] == self.REL_FATHER):
if Gb < len(_nephew_level_of_brothers_son):
rel_str = _nephew_level_of_brothers_son[Gb]
@@ -743,7 +743,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = "męski potomek w %d pokoleniu brata" % Gb
# córka brata
- elif (gender_b == gen.lib.Person.FEMALE) \
+ elif (gender_b == Person.FEMALE) \
& (reltocommon_b[0] == self.REL_FATHER):
if Gb < len(_nephew_level_of_brothers_daughter):
rel_str = _nephew_level_of_brothers_daughter[Gb]
@@ -751,7 +751,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = "żeński potomek w %d pokoleniu brata" % Gb
# syn siostry
- if (gender_b == gen.lib.Person.MALE) \
+ if (gender_b == Person.MALE) \
& (reltocommon_b[0] == self.REL_MOTHER):
if Gb < len(_nephew_level_of_sisters_son):
rel_str = _nephew_level_of_sisters_son[Gb]
@@ -759,7 +759,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = "męski potomek w %d pokoleniu brata" % Gb
# córka siostry
- elif (gender_b == gen.lib.Person.FEMALE) \
+ elif (gender_b == Person.FEMALE) \
& (reltocommon_b[0] == self.REL_MOTHER):
if Gb < len(_nephew_level_of_sisters_daughter):
rel_str = _nephew_level_of_sisters_daughter[Gb]
@@ -778,13 +778,13 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = "potomek w %d pokoleniu rodzeństwa" % Gb
elif Ga > 1 and Gb > 1:
- if (gender_b == gen.lib.Person.MALE):
+ if (gender_b == Person.MALE):
if Ga == 2 and Gb == 2:
rel_str = "kuzyn"
else:
rel_str = "daleki kuzyn (%d. stopień pokrewieństwa)" % (Ga+Gb)
- elif (gender_b == gen.lib.Person.FEMALE):
+ elif (gender_b == Person.FEMALE):
if Ga == 2 and Gb == 2:
rel_str = "kuzynka"
else:
@@ -853,17 +853,17 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if sib_type == self.NORM_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'brat (rodzony)'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'siostra (rodzona)'
else:
rel_str = 'brat lub siostra (rodzeni)'
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
# TODO: znaleźć odpowiednik
rel_str = "brat (pasierb)"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
# TODO: znaleźć odpowiednik
rel_str = "siostra (pasierbica)"
else:
@@ -871,40 +871,40 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = "brat lub siostra (pasierb/pasierbica)"
elif sib_type == self.UNKNOWN_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'brat'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'siostra'
else:
rel_str = 'brat lub siostra'
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
# TODO: znaleźć odpowiednik
rel_str = "brat (brat/szwagier)"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
# TODO: znaleźć odpowiednik
rel_str = "siostra (bratowa/szwagierka)"
else:
# TODO: znaleźć odpowiednik
rel_str = "brat lub siostra (szwagier/szagierka)"
elif sib_type == self.HALF_SIB_FATHER:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "brat przyrodni"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "siostra przyrodnia"
else:
rel_str = "brat/siostra przyrodni"
elif sib_type == self.HALF_SIB_MOTHER:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "brat przyrodni"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "siostra przyrodnia"
else:
rel_str = "brat/siostra przyrodni"
elif sib_type == self.STEP_SIB:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "brat przyrodni"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "siostra przyrodnia"
else:
rel_str = "brat lub siostra przyrodnia"
diff --git a/gramps/plugins/rel/rel_pt.py b/gramps/plugins/rel/rel_pt.py
index 5741fe194..4c2e7f934 100644
--- a/gramps/plugins/rel/rel_pt.py
+++ b/gramps/plugins/rel/rel_pt.py
@@ -34,7 +34,7 @@ Specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -289,47 +289,47 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if firstRel == 0:
if secondRel == 0:
return ('', common)
- elif other_person_gender == gen.lib.Person.MALE:
+ elif other_person_gender == Person.MALE:
return (self.get_father(secondRel), common)
else:
return (self.get_mother(secondRel), common)
elif secondRel == 0:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_son(firstRel), common)
else:
return (self.get_daughter(firstRel), common)
elif firstRel == 1:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_uncle(secondRel), common)
else:
return (self.get_aunt(secondRel), common)
elif secondRel == 1:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_nephew(firstRel-1), common)
else:
return (self.get_niece(firstRel-1), common)
elif firstRel == secondRel == 2:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return ('primo irmão', common)
else:
return ('prima irmã', common)
elif firstRel == secondRel:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_male_cousin(firstRel-1), common)
else:
return (self.get_female_cousin(firstRel-1), common)
elif firstRel == secondRel+1:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_distant_nephew(secondRel), common)
else:
return (self.get_distant_niece(secondRel), common)
elif firstRel+1 == secondRel:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_distant_uncle(firstRel), common)
else:
return (self.get_distant_aunt(firstRel), common)
else:
- if other_person_gender == gen.lib.Person.MALE:
+ if other_person_gender == Person.MALE:
return (self.get_male_relative(firstRel, secondRel), common)
else:
return (self.get_female_relative(firstRel, secondRel), common)
diff --git a/gramps/plugins/rel/rel_ru.py b/gramps/plugins/rel/rel_ru.py
index 31643ba48..5fbf1c7dd 100644
--- a/gramps/plugins/rel/rel_ru.py
+++ b/gramps/plugins/rel/rel_ru.py
@@ -33,7 +33,7 @@ Russian-specific definitions of relationships
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -403,32 +403,32 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if Gb == 0:
if Ga == 0:
return ('один человек')
- elif gender_b == gen.lib.Person.MALE:
+ elif gender_b == Person.MALE:
return (self.get_father(Ga))
else:
return (self.get_mother(Ga))
elif Ga == 0:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
return (self.get_son(Gb))
else:
return (self.get_daughter(Gb))
elif Gb == 1:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
return (self._get_uncle(Ga))
else:
return (self._get_aunt(Ga))
elif Ga == 1:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
return (self.get_nephew(Gb-1))
else:
return (self.get_niece(Gb-1))
elif Ga > Gb:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
return (self.get_senior_male_cousin(Gb-1, Ga-Gb))
else:
return (self.get_senior_female_cousin(Gb-1, Ga-Gb))
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
return (self.get_junior_male_cousin(Ga-1, Gb-Ga))
else:
return (self.get_junior_female_cousin(Ga-1, Gb-Ga))
diff --git a/gramps/plugins/rel/rel_sk.py b/gramps/plugins/rel/rel_sk.py
index 7a37af88a..bc997ca8b 100644
--- a/gramps/plugins/rel/rel_sk.py
+++ b/gramps/plugins/rel/rel_sk.py
@@ -30,7 +30,7 @@ Slovak-specific classes for relationships.
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -343,30 +343,30 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# b is descendant of a
if Gb == 0 :
rel_str = 'tá istá osoba'
- elif gender_b == gen.lib.Person.MALE and Gb < len(_son_level):
+ elif gender_b == Person.MALE and Gb < len(_son_level):
# spouse of daughter
if inlaw and Gb == 1 and not step:
rel_str = "zať"
else:
rel_str = self.get_son(Gb)
- elif gender_b == gen.lib.Person.FEMALE and Gb < len(_daughter_level):
+ elif gender_b == Person.FEMALE and Gb < len(_daughter_level):
# spouse of son
if inlaw and Gb == 1 and not step:
rel_str = "nevesta"
else:
rel_str = self.get_daughter(Gb)
# don't display inlaw
- elif Gb < len(_level_name) and gender_b == gen.lib.Person.MALE:
+ elif Gb < len(_level_name) and gender_b == Person.MALE:
rel_str = "vzdialený potomok (%d generácia)" % (
Gb+1)
- elif Gb < len(_level_name) and gender_b == gen.lib.Person.FEMALE:
+ elif Gb < len(_level_name) and gender_b == Person.FEMALE:
rel_str = "vzdialený potomok(žena) (%d generácia)" % (
Gb+1)
else:
return self.get_child_unknown(Gb)
elif Gb == 0:
# b is parents/grand parent of a
- if gender_b == gen.lib.Person.MALE and Ga < len(_father_level):
+ if gender_b == Person.MALE and Ga < len(_father_level):
# other spouse of father (new parent)
if Ga == 1 and inlaw and self.STEP_SIB:
rel_str = "svokor"
@@ -375,7 +375,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = "otec partnera"
else:
rel_str = self.get_father(Ga, inlaw)
- elif gender_b == gen.lib.Person.FEMALE and Ga < len(_mother_level):
+ elif gender_b == Person.FEMALE and Ga < len(_mother_level):
# other spouse of mother (new parent)
if Ga == 1 and inlaw and self.STEP_SIB:
rel_str = "svokra"
@@ -384,58 +384,58 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
rel_str = "matka partnera"
else:
rel_str = self.get_mother(Ga, inlaw)
- elif Ga < len(_level_name) and gender_b == gen.lib.Person.MALE:
+ elif Ga < len(_level_name) and gender_b == Person.MALE:
rel_str = "vzdialený predok%s (%d generácia)" % (
inlaw, Ga+1)
- elif Ga < len(_level_name) and gender_b == gen.lib.Person.FEMALE:
+ elif Ga < len(_level_name) and gender_b == Person.FEMALE:
rel_str = "vzdialený predok(žena)%s (%d generácia)" % (
inlaw, Ga+1)
else:
return self.get_parent_unknown(Ga, inlaw)
elif Gb == 1:
# b is sibling/aunt/uncle of a
- if gender_b == gen.lib.Person.MALE and Ga < len(_brother_level):
+ if gender_b == Person.MALE and Ga < len(_brother_level):
rel_str = self.get_uncle(Ga, inlaw)
- elif gender_b == gen.lib.Person.FEMALE and Ga < len(_sister_level):
+ elif gender_b == Person.FEMALE and Ga < len(_sister_level):
rel_str = self.get_aunt(Ga, inlaw)
else:
# don't display inlaw
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "vzdialený strýko" + bygen % (
Ga+1)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "vzdialená teta" + bygen % (
Ga+1)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw)
else:
return rel_str
elif Ga == 1:
# b is niece/nephew of a
- if gender_b == gen.lib.Person.MALE and Gb < len(_nephew_level):
+ if gender_b == Person.MALE and Gb < len(_nephew_level):
rel_str = self.get_nephew(Gb-1, inlaw)
- elif gender_b == gen.lib.Person.FEMALE and Gb < len(_niece_level):
+ elif gender_b == Person.FEMALE and Gb < len(_niece_level):
rel_str = self.get_niece(Gb-1, inlaw)
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "vzdialený synovec%s (%d generácia)" % (
inlaw, Gb)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "vzdialená neter%s (%d generácia)" % (
inlaw, Gb)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw)
else:
return rel_str
elif Ga == Gb:
# a and b cousins in the same generation
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self.get_cousin(Ga-1, 0, dir = '',
inlaw=inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = self.get_cousine(Ga-1, 0, dir = '',
inlaw=inlaw)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga-1, inlaw)
else:
return rel_str
@@ -444,13 +444,13 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# being in a higher generation from the common ancestor than the
# first person.
if Ga == 3 and Gb == 2:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
desc = " (bratranec niektorého z rodičov)"
rel_str = "strýko z druhého kolena" + desc
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
desc = " (sesternica niektorého z rodičov)"
rel_str = "teta z druhého kolena" + desc
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
return self.get_sibling_unknown(Ga, inlaw)
else:
return rel_str
@@ -458,20 +458,20 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
can = " z %s do %s stupňa (kan.)" % (
_removed_level[Gb], _removed_level[Ga] )
civ = " a do %s stupňa (civ.)" % ( _removed_level[Ga+Gb+1] )
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "strýko" + can + civ
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "teta" + can + civ
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw)
else:
return rel_str
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self.get_uncle(Ga, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = self.get_aunt(Ga, inlaw)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw)
else:
return rel_str
@@ -481,11 +481,11 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# first person.
if Ga == 2 and Gb == 3:
info = " (potomok bratranca/sesternice)"
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "synovec z druhého kolena" + info
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "neter z druhého kolena" + info
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw)
else:
return rel_str
@@ -493,22 +493,22 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
can = " z %s do %s stupňa (kan.)" % (
_removed_level[Gb], _removed_level[Ga] )
civ = " a do %s stupňa (civ.)" % ( _removed_level[Ga+Gb+1] )
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "synovec" + can + civ
- if gender_b == gen.lib.Person.FEMALE:
+ if gender_b == Person.FEMALE:
rel_str = "neter" + can + civ
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw)
else:
return rel_str
elif Ga > len(_level_name):
return rel_str
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = self.get_nephew(Ga, inlaw)
- elif gender_b ==gen.lib.Person.FEMALE:
+ elif gender_b ==Person.FEMALE:
rel_str = self.get_niece(Ga, inlaw)
- elif gender_b == gen.lib.Person.UNKNOWN:
+ elif gender_b == Person.UNKNOWN:
rel_str = self.get_sibling_unknown(Ga, inlaw)
else:
return rel_str
@@ -526,54 +526,54 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if sib_type == self.NORM_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'brat (vlastný)'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'sestra (vlastná)'
else:
rel_str = 'vlastný brat alebo sestra'
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "švagor"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "švagriná"
else:
rel_str = "švagor alebo švagriná"
elif sib_type == self.UNKNOWN_SIB:
if not inlaw:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = 'brat'
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = 'sestra'
else:
rel_str = 'brat alebo sestra'
else:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "švagor"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "švagriná"
else:
rel_str = "švagor alebo švagriná"
# oznacenie vyberu spolocny otec, rev.
elif sib_type == self.HALF_SIB_MOTHER:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "nevlastný brat -spoloč.otec"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "nevlastná sestra -spoloč.otec"
else:
rel_str = "nevlastný brat alebo sestra -spoloč.otec"
# oznacenie vyberu spolocna matka, rev.
elif sib_type == self.HALF_SIB_FATHER:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "nevlastný brat -spoloč.matka"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "nevlastná sestra -spoloč.matka"
else:
rel_str = "nevlastný brat alebo sestra -spoloč.matka"
elif sib_type == self.STEP_SIB:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "nevlastný brat"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "nevlastná sestra"
else:
rel_str = "nevlastný brat alebo sestra"
diff --git a/gramps/plugins/rel/rel_sl.py b/gramps/plugins/rel/rel_sl.py
index 1aac96412..29a52b13e 100644
--- a/gramps/plugins/rel/rel_sl.py
+++ b/gramps/plugins/rel/rel_sl.py
@@ -33,7 +33,7 @@ Slovenian-specific definitions of relationships
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -187,33 +187,33 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
"""
if Gb == 0:
if Ga == 0: rel_str = "ista oseba"
- elif gender_b == gen.lib.Person.MALE:
+ elif gender_b == Person.MALE:
rel_str = (self.getFather(Ga))
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = (self.getMother(Ga))
else:
rel_str = (self.getAncestor(Ga))
elif Ga == 0:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = (self.getSon(Gb))
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = (self.getDaughter(Gb))
else:
rel_str = (self.getDescendant(Gb))
elif Ga == Gb:
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = (self.getMaleCousin(Gb))
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = (self.getFemaleCousin(Gb))
else:
rel_str = (self.getSomeCousin(Gb))
elif Ga > Gb:
- if gender_b == gen.lib.Person.FEMALE:
+ if gender_b == Person.FEMALE:
rel_str = (self.getAunt(Ga+Gb, Ga-Gb))
else:
rel_str = (self.getUncle(Ga+Gb, Ga-Gb)) # we'll use male for unknown sex
else: #Ga < Gb
- if gender_b == gen.lib.Person.FEMALE:
+ if gender_b == Person.FEMALE:
rel_str = (self.getNiece(Ga+Gb, Gb-Ga))
else:
rel_str = (self.getNephew(Ga+Gb, Gb-Ga)) # we'll use male for unknown sex
@@ -241,16 +241,16 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
if sib_type < self.STEP_SIB:
# ie. NORM_SIB or one of HALF_SIBs
if not inlaw:
- if gender == gen.lib.Person.MALE:
+ if gender == Person.MALE:
rel_str = u"%sbrat" % (prefix)
- elif gender == gen.lib.Person.FEMALE:
+ elif gender == Person.FEMALE:
rel_str = u"%ssestra" % (prefix)
else:
rel_str = u"%sbrat ali %ssestra" % (prefix, prefix)
else:
- if gender == gen.lib.Person.MALE:
+ if gender == Person.MALE:
rel_str = u"%ssvak" % (prefix)
- elif gender == gen.lib.Person.FEMALE:
+ elif gender == Person.FEMALE:
rel_str = u"%ssvakinja" % (prefix)
else:
rel_str = u"%ssvak ali %ssvakinja" % (prefix, prefix)
diff --git a/gramps/plugins/rel/rel_sv.py b/gramps/plugins/rel/rel_sv.py
index 2aedffded..e9aeb8912 100644
--- a/gramps/plugins/rel/rel_sv.py
+++ b/gramps/plugins/rel/rel_sv.py
@@ -36,7 +36,7 @@ Swedish-specific definitions of relationships
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
import gen.relationship
#-------------------------------------------------------------------------
@@ -130,11 +130,11 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('far')
else:
result.append('mor')
- if person_gender == gen.lib.Person.MALE:
+ if person_gender == Person.MALE:
result[-1] = 'far'
- if person_gender == gen.lib.Person.FEMALE:
+ if person_gender == Person.FEMALE:
result[-1] = 'mor'
- if person_gender == gen.lib.Person.UNKNOWN:
+ if person_gender == Person.UNKNOWN:
result[-1] = u'förälder'
if step != '' and len(result)==1:
#Preceed with step prefix of father/mother
@@ -143,7 +143,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
#Preceed with inlaw prefix
result[-1] = u'svär' + result[-1]
if len(result)>1 and len(result) % 2 == 0 and \
- (person_gender == gen.lib.Person.UNKNOWN or inlaw != ''):
+ (person_gender == Person.UNKNOWN or inlaw != ''):
# Correct string "-2" with genitive s and add a space to get
# correct Swedish, if even number in result
result[-2] = result[-2] + 's '
@@ -156,14 +156,14 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('son')
else:
result.append('dotter')
- if person_gender == gen.lib.Person.MALE:
+ if person_gender == Person.MALE:
result.append('son')
- elif person_gender == gen.lib.Person.FEMALE:
+ elif person_gender == Person.FEMALE:
result.append('dotter')
else:
- if person_gender == gen.lib.Person.UNKNOWN and inlaw == '':
+ if person_gender == Person.UNKNOWN and inlaw == '':
result.append('barn')
- if person_gender == gen.lib.Person.UNKNOWN and inlaw != '':
+ if person_gender == Person.UNKNOWN and inlaw != '':
result.append('-son/dotter')
if step != '' and len(result)==1:
result[0] = self.STEP + result[0]
@@ -171,7 +171,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
#Preceed with inlaw prefix
result[-1] = u'svär' + result[-1]
if len(result)>1 and len(result) % 2 == 0 and \
- (person_gender == gen.lib.Person.UNKNOWN or inlaw != ''):
+ (person_gender == Person.UNKNOWN or inlaw != ''):
# Correct string "-2" with genitive s and add a space to get
# correct Swedish, if even number in result
result[-2] = result[-2] + 's '
@@ -208,14 +208,14 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
result.append('son')
else:
result.append('dotter')
- if person_gender == gen.lib.Person.MALE:
+ if person_gender == Person.MALE:
result.append('son')
- elif person_gender == gen.lib.Person.FEMALE:
+ elif person_gender == Person.FEMALE:
result.append('dotter')
else:
- if person_gender == gen.lib.Person.UNKNOWN and inlaw == '':
+ if person_gender == Person.UNKNOWN and inlaw == '':
result.append('barn')
- if person_gender == gen.lib.Person.UNKNOWN and inlaw != '':
+ if person_gender == Person.UNKNOWN and inlaw != '':
result.append('-son/dotter')
if step != '' and len(result) == 1:
result[0] = self.STEP + result[0]
@@ -223,7 +223,7 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
#Preceed with inlaw prefix
result[-1] = u'svär' + result[-1]
if len(result)>1 and len(result) % 2 == 0 and \
- (person_gender == gen.lib.Person.UNKNOWN or inlaw != ''):
+ (person_gender == Person.UNKNOWN or inlaw != ''):
# Correct string "-2" with genitive s and add a space to get
# correct Swedish, if even number in result
result[-2] = result[-2] + 's '
@@ -237,17 +237,17 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
else:
result.append('mor')
result.append('bror')
- if person_gender == gen.lib.Person.UNKNOWN: result[-1] = 'syskon'
+ if person_gender == Person.UNKNOWN: result[-1] = 'syskon'
if step != '' and len(result)==1:
result[0] = self.STEP + result[0]
if inlaw != '':
#Preceed with inlaw prefix
result[-1] = u'svåger'
- if inlaw != '' and person_gender == gen.lib.Person.UNKNOWN:
+ if inlaw != '' and person_gender == Person.UNKNOWN:
#Preceed with inlaw prefix
result[-1] = u'svåger/svägerska'
if len(result)>1 and len(result) % 2 == 0 and \
- (person_gender == gen.lib.Person.UNKNOWN or inlaw != ''):
+ (person_gender == Person.UNKNOWN or inlaw != ''):
# Correct string "-2" with genitive s and add a space to get
# correct Swedish, if even number in result
result[-2] = result[-2] + 's '
@@ -292,9 +292,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
elif sib_type == self.STEP_SIB:
typestr = self.STEP
- if gender_b == gen.lib.Person.MALE:
+ if gender_b == Person.MALE:
rel_str = "bror"
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = "syster"
else:
rel_str = "syskon"
@@ -509,9 +509,9 @@ class RelationshipCalculator(gen.relationship.RelationshipCalculator):
# b is sibling/aunt/uncle of a
# handles brother and unknown gender as second person,
# shows up in "testing unknown cousins same generation"
- if gender_b == gen.lib.Person.MALE or gender_b == gen.lib.Person.UNKNOWN:
+ if gender_b == Person.MALE or gender_b == Person.UNKNOWN:
rel_str = self._get_ancestors_brother(reltocommon_a, gender_b, step, inlaw)
- elif gender_b == gen.lib.Person.FEMALE:
+ elif gender_b == Person.FEMALE:
rel_str = self._get_ancestors_sister(reltocommon_a, step, inlaw)
elif Ga == Gb:
# a and b cousins in the same generation
diff --git a/gramps/plugins/textreport/familygroup.py b/gramps/plugins/textreport/familygroup.py
index 19bc6c1b9..1439f0cbb 100644
--- a/gramps/plugins/textreport/familygroup.py
+++ b/gramps/plugins/textreport/familygroup.py
@@ -37,7 +37,7 @@ from functools import partial
# GRAMPS
#
#------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventRoleType, EventType, NoteType, Person
from gen.plug.menu import (BooleanOption, FamilyOption, EnumeratedListOption)
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
@@ -260,7 +260,7 @@ class FamilyGroup(Report):
self.doc.write_styled_note(note.get_styledtext(),
note.get_format(), 'FGR-Note',
contains_html= (note.get_type() ==
- gen.lib.NoteType.HTML_CODE)
+ NoteType.HTML_CODE)
)
self.doc.end_cell()
self.doc.end_row()
@@ -270,7 +270,7 @@ class FamilyGroup(Report):
if not person_handle and not self.missingInfo:
return
elif not person_handle:
- person = gen.lib.Person()
+ person = Person()
else:
person = self.database.get_person_from_handle(person_handle)
name = self._name_display.display(person)
@@ -288,7 +288,7 @@ class FamilyGroup(Report):
birth_ref = person.get_birth_ref()
birth = None
- evtName = str(gen.lib.EventType())
+ evtName = str(EventType())
if birth_ref:
birth = self.database.get_event_from_handle(birth_ref.ref)
if birth or self.missingInfo:
@@ -296,7 +296,7 @@ class FamilyGroup(Report):
death_ref = person.get_death_ref()
death = None
- evtName = str(gen.lib.EventType(gen.lib.EventType.DEATH))
+ evtName = str(EventType(EventType.DEATH))
if death_ref:
death = self.database.get_event_from_handle(death_ref.ref)
if death or self.missingInfo:
@@ -363,9 +363,9 @@ class FamilyGroup(Report):
for event_ref in family_list:
if event_ref:
event = self.database.get_event_from_handle(event_ref.ref)
- if event.get_type() == gen.lib.EventType.MARRIAGE and \
- (event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
- event_ref.get_role() == gen.lib.EventRoleType.PRIMARY):
+ if event.get_type() == EventType.MARRIAGE and \
+ (event_ref.get_role() == EventRoleType.FAMILY or
+ event_ref.get_role() == EventRoleType.PRIMARY):
m = event
break
@@ -384,7 +384,7 @@ class FamilyGroup(Report):
for event_ref in family_list:
if event_ref:
event = self.database.get_event_from_handle(event_ref.ref)
- if event.get_type() != gen.lib.EventType.MARRIAGE:
+ if event.get_type() != EventType.MARRIAGE:
self.dump_parent_event(str(event.get_type()),event)
self.doc.end_table()
@@ -454,9 +454,9 @@ class FamilyGroup(Report):
self.doc.start_cell('FGR-TextChild2')
self.doc.start_paragraph('FGR-ChildText')
index_str = ("%d" % index)
- if person.get_gender() == gen.lib.Person.MALE:
+ if person.get_gender() == Person.MALE:
self.doc.write_text(index_str + _("acronym for male|M"))
- elif person.get_gender() == gen.lib.Person.FEMALE:
+ elif person.get_gender() == Person.FEMALE:
self.doc.write_text(index_str + _("acronym for female|F"))
else:
self.doc.write_text(_("acronym for unknown|%dU") % index)
@@ -494,7 +494,7 @@ class FamilyGroup(Report):
for event_ref in family.get_event_ref_list():
if event_ref:
event = self.database.get_event_from_handle(event_ref.ref)
- if event.type == gen.lib.EventType.MARRIAGE:
+ if event.type == EventType.MARRIAGE:
m = event
break
@@ -544,7 +544,7 @@ class FamilyGroup(Report):
self.doc.end_row()
if m:
- evtName = str(gen.lib.EventType(gen.lib.EventType.MARRIAGE))
+ evtName = str(EventType(EventType.MARRIAGE))
if index == families:
self.dump_child_event('FGR-TextChild2',evtName,m)
else:
diff --git a/gramps/plugins/textreport/summary.py b/gramps/plugins/textreport/summary.py
index 9f63faa37..899b23a3c 100644
--- a/gramps/plugins/textreport/summary.py
+++ b/gramps/plugins/textreport/summary.py
@@ -39,7 +39,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Person
from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils
from gen.plug.report import MenuReportOptions
@@ -139,9 +139,9 @@ class SummaryReport(Report):
missing_bday += 1
# Count genders.
- 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/tool/check.py b/gramps/plugins/tool/check.py
index b769ca9e8..939b7c6c0 100644
--- a/gramps/plugins/tool/check.py
+++ b/gramps/plugins/tool/check.py
@@ -61,7 +61,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Citation, Event, EventType, Family, MediaObject, Name, Note, Person, Place, Repository, Source, StyledText, Tag
from gen.db import DbTxn
from gen.config import config
from gen.utils.id import create_id
@@ -229,7 +229,7 @@ class CheckIntegrity(object):
self.empty_objects = defaultdict(list)
self.last_img_dir = config.get('behavior.addmedia-image-dir')
self.progress = ProgressMeter(_('Checking Database'),'')
- self.explanation = gen.lib.Note(_('Objects referenced by this note '
+ self.explanation = Note(_('Objects referenced by this note '
'were referenced but missing so that is why they have been created '
'when you ran Check and Repair on %s.') %
time.strftime('%x %X', time.localtime()))
@@ -265,10 +265,10 @@ class CheckIntegrity(object):
p_changed = False
name = person.get_primary_name()
if name.get_sort_as() in deleted_name_formats:
- name.set_sort_as(gen.lib.Name.DEF)
+ name.set_sort_as(Name.DEF)
p_changed = True
if name.get_display_as() in deleted_name_formats:
- name.set_display_as(gen.lib.Name.DEF)
+ name.set_display_as(Name.DEF)
p_changed = True
if p_changed:
person.set_primary_name(name)
@@ -277,10 +277,10 @@ class CheckIntegrity(object):
name_list = []
for name in person.get_alternate_names():
if name.get_sort_as() in deleted_name_formats:
- name.set_sort_as(gen.lib.Name.DEF)
+ name.set_sort_as(Name.DEF)
a_changed = True
if name.get_display_as() in deleted_name_formats:
- name.set_display_as(gen.lib.Name.DEF)
+ name.set_display_as(Name.DEF)
a_changed = True
name_list.append(name)
if a_changed:
@@ -310,7 +310,7 @@ class CheckIntegrity(object):
for handle in self.db.person_map.keys():
value = self.db.person_map[handle]
- p = gen.lib.Person(value)
+ p = Person(value)
splist = p.get_family_handle_list()
if len(splist) != len(set(splist)):
new_list = []
@@ -380,7 +380,7 @@ class CheckIntegrity(object):
self.db.note_map[handle][1])
error_count += 1
# Commit only if ctrl char found.
- note.set_styledtext(gen.lib.StyledText(text=new_text,
+ note.set_styledtext(StyledText(text=new_text,
tags=stext.get_tags()))
self.db.commit_note(note, self.trans)
self.progress.step()
@@ -742,15 +742,15 @@ class CheckIntegrity(object):
CHANGE_REPOS = 7
CHANGE_NOTE = 5
- empty_person_data = gen.lib.Person().serialize()
- empty_family_data = gen.lib.Family().serialize()
- empty_event_data = gen.lib.Event().serialize()
- empty_source_data = gen.lib.Source().serialize()
- empty_citation_data = gen.lib.Citation().serialize()
- empty_place_data = gen.lib.Place().serialize()
- empty_media_data = gen.lib.MediaObject().serialize()
- empty_repos_data = gen.lib.Repository().serialize()
- empty_note_data = gen.lib.Note().serialize()
+ empty_person_data = Person().serialize()
+ empty_family_data = Family().serialize()
+ empty_event_data = Event().serialize()
+ empty_source_data = Source().serialize()
+ empty_citation_data = Citation().serialize()
+ empty_place_data = Place().serialize()
+ empty_media_data = MediaObject().serialize()
+ empty_repos_data = Repository().serialize()
+ empty_note_data = Note().serialize()
_db = self.db
def _empty(empty, flag):
@@ -943,8 +943,8 @@ class CheckIntegrity(object):
else:
mgender = None
- if (fgender == gen.lib.Person.FEMALE
- or mgender == gen.lib.Person.MALE) and fgender != mgender:
+ if (fgender == Person.FEMALE
+ or mgender == Person.MALE) and fgender != mgender:
# swap. note: (at most) one handle may be None
logging.warning(' FAIL: the family "%s" has a father=female or '
' mother=male in a different sex family' % family.gramps_id)
@@ -981,7 +981,7 @@ class CheckIntegrity(object):
# This is tested by TestcaseGenerator person "Broken11"
make_unknown(birth_handle, self.explanation.handle,
self.class_event, self.commit_event, self.trans,
- type=gen.lib.EventType.BIRTH)
+ type=EventType.BIRTH)
logging.warning(' FAIL: the person "%(gid)s" refers to '
'a birth event "%(hand)s" which does not '
'exist in the database' %
@@ -989,7 +989,7 @@ class CheckIntegrity(object):
'hand' : birth_handle})
self.invalid_events.add(key)
else:
- if int(birth.get_type()) != gen.lib.EventType.BIRTH:
+ if int(birth.get_type()) != EventType.BIRTH:
# Birth event was not of the type "Birth"
# This is tested by TestcaseGenerator person "Broken14"
logging.warning(' FAIL: the person "%(gid)s" refers '
@@ -997,7 +997,7 @@ class CheckIntegrity(object):
'"%(type)s" instead of Birth' %
{'gid' : person.gramps_id,
'type' : int(birth.get_type())})
- birth.set_type(gen.lib.EventType(gen.lib.EventType.BIRTH))
+ birth.set_type(EventType(EventType.BIRTH))
self.db.commit_event(birth, self.trans)
self.invalid_birth_events.add(key)
if none_handle:
@@ -1024,10 +1024,10 @@ class CheckIntegrity(object):
'hand' : death_handle})
make_unknown(death_handle, self.explanation.handle,
self.class_event, self.commit_event, self.trans,
- type=gen.lib.EventType.DEATH)
+ type=EventType.DEATH)
self.invalid_events.add(key)
else:
- if int(death.get_type()) != gen.lib.EventType.DEATH:
+ if int(death.get_type()) != EventType.DEATH:
# Death event was not of the type "Death"
# This is tested by TestcaseGenerator person "Broken15"
logging.warning(' FAIL: the person "%(gid)s" refers '
@@ -1035,7 +1035,7 @@ class CheckIntegrity(object):
'"%(type)s" instead of Death' %
{'gid' : person.gramps_id,
'type' : int(death.get_type())})
- death.set_type(gen.lib.EventType(gen.lib.EventType.DEATH))
+ death.set_type(EventType(EventType.DEATH))
self.db.commit_event(death, self.trans)
self.invalid_death_events.add(key)
if none_handle:
@@ -1293,7 +1293,7 @@ class CheckIntegrity(object):
for handle in self.db.person_map.keys():
self.progress.step()
info = self.db.person_map[handle]
- person = gen.lib.Person()
+ person = Person()
person.unserialize(info)
handle_list = person.get_referenced_handles_recursively()
for item in handle_list:
@@ -1309,7 +1309,7 @@ class CheckIntegrity(object):
for handle in self.db.family_map.keys():
self.progress.step()
info = self.db.family_map[handle]
- family = gen.lib.Family()
+ family = Family()
family.unserialize(info)
handle_list = family.get_referenced_handles_recursively()
for item in handle_list:
@@ -1325,7 +1325,7 @@ class CheckIntegrity(object):
for handle in self.db.place_map.keys():
self.progress.step()
info = self.db.place_map[handle]
- place = gen.lib.Place()
+ place = Place()
place.unserialize(info)
handle_list = place.get_referenced_handles_recursively()
for item in handle_list:
@@ -1341,7 +1341,7 @@ class CheckIntegrity(object):
for handle in self.db.citation_map.keys():
self.progress.step()
info = self.db.citation_map[handle]
- citation = gen.lib.Citation()
+ citation = Citation()
citation.unserialize(info)
handle_list = citation.get_referenced_handles_recursively()
for item in handle_list:
@@ -1357,7 +1357,7 @@ class CheckIntegrity(object):
for handle in self.db.repository_map.keys():
self.progress.step()
info = self.db.repository_map[handle]
- repository = gen.lib.Repository()
+ repository = Repository()
repository.unserialize(info)
handle_list = repository.get_referenced_handles_recursively()
for item in handle_list:
@@ -1373,7 +1373,7 @@ class CheckIntegrity(object):
for handle in self.db.media_map.keys():
self.progress.step()
info = self.db.media_map[handle]
- obj = gen.lib.MediaObject()
+ obj = MediaObject()
obj.unserialize(info)
handle_list = obj.get_referenced_handles_recursively()
for item in handle_list:
@@ -1389,7 +1389,7 @@ class CheckIntegrity(object):
for handle in self.db.event_map.keys():
self.progress.step()
info = self.db.event_map[handle]
- event = gen.lib.Event()
+ event = Event()
event.unserialize(info)
handle_list = event.get_referenced_handles_recursively()
for item in handle_list:
@@ -1461,7 +1461,7 @@ class CheckIntegrity(object):
for handle in self.db.person_map.keys():
self.progress.step()
info = self.db.person_map[handle]
- person = gen.lib.Person()
+ person = Person()
person.unserialize(info)
handle_list = person.get_referenced_handles_recursively()
for item in handle_list:
@@ -1477,7 +1477,7 @@ class CheckIntegrity(object):
for handle in self.db.family_map.keys():
self.progress.step()
info = self.db.family_map[handle]
- family = gen.lib.Family()
+ family = Family()
family.unserialize(info)
handle_list = family.get_referenced_handles_recursively()
for item in handle_list:
@@ -1493,7 +1493,7 @@ class CheckIntegrity(object):
for handle in self.db.place_map.keys():
self.progress.step()
info = self.db.place_map[handle]
- place = gen.lib.Place()
+ place = Place()
place.unserialize(info)
handle_list = place.get_referenced_handles_recursively()
for item in handle_list:
@@ -1509,7 +1509,7 @@ class CheckIntegrity(object):
for handle in self.db.event_map.keys():
self.progress.step()
info = self.db.event_map[handle]
- event = gen.lib.Event()
+ event = Event()
event.unserialize(info)
handle_list = event.get_referenced_handles_recursively()
for item in handle_list:
@@ -1525,7 +1525,7 @@ class CheckIntegrity(object):
for handle in self.db.citation_map.keys():
self.progress.step()
info = self.db.citation_map[handle]
- citation = gen.lib.Citation()
+ citation = Citation()
citation.unserialize(info)
handle_list = citation.get_referenced_handles_recursively()
for item in handle_list:
@@ -1541,7 +1541,7 @@ class CheckIntegrity(object):
for handle in self.db.source_map.keys():
self.progress.step()
info = self.db.source_map[handle]
- source = gen.lib.Source()
+ source = Source()
source.unserialize(info)
handle_list = source.get_referenced_handles_recursively()
for item in handle_list:
@@ -1597,7 +1597,7 @@ class CheckIntegrity(object):
for handle in self.db.person_map.keys():
self.progress.step()
info = self.db.person_map[handle]
- person = gen.lib.Person()
+ person = Person()
person.unserialize(info)
handle_list = person.get_referenced_handles_recursively()
for item in handle_list:
@@ -1613,7 +1613,7 @@ class CheckIntegrity(object):
for handle in self.db.family_map.keys():
self.progress.step()
info = self.db.family_map[handle]
- family = gen.lib.Family()
+ family = Family()
family.unserialize(info)
handle_list = family.get_referenced_handles_recursively()
for item in handle_list:
@@ -1629,7 +1629,7 @@ class CheckIntegrity(object):
for handle in self.db.place_map.keys():
self.progress.step()
info = self.db.place_map[handle]
- place = gen.lib.Place()
+ place = Place()
place.unserialize(info)
handle_list = place.get_referenced_handles_recursively()
for item in handle_list:
@@ -1645,7 +1645,7 @@ class CheckIntegrity(object):
for handle in self.db.citation_map.keys():
self.progress.step()
info = self.db.citation_map[handle]
- citation = gen.lib.Citation()
+ citation = Citation()
citation.unserialize(info)
handle_list = citation.get_referenced_handles_recursively()
for item in handle_list:
@@ -1661,7 +1661,7 @@ class CheckIntegrity(object):
for handle in self.db.source_map.keys():
self.progress.step()
info = self.db.source_map[handle]
- source = gen.lib.Source()
+ source = Source()
source.unserialize(info)
handle_list = source.get_referenced_handles_recursively()
for item in handle_list:
@@ -1677,7 +1677,7 @@ class CheckIntegrity(object):
for handle in self.db.media_map.keys():
self.progress.step()
info = self.db.media_map[handle]
- obj = gen.lib.MediaObject()
+ obj = MediaObject()
obj.unserialize(info)
handle_list = obj.get_referenced_handles_recursively()
for item in handle_list:
@@ -1693,7 +1693,7 @@ class CheckIntegrity(object):
for handle in self.db.event_map.keys():
self.progress.step()
info = self.db.event_map[handle]
- event = gen.lib.Event()
+ event = Event()
event.unserialize(info)
handle_list = event.get_referenced_handles_recursively()
for item in handle_list:
@@ -1709,7 +1709,7 @@ class CheckIntegrity(object):
for handle in self.db.repository_map.keys():
self.progress.step()
info = self.db.repository_map[handle]
- repo = gen.lib.Repository()
+ repo = Repository()
repo.unserialize(info)
handle_list = repo.get_referenced_handles_recursively()
for item in handle_list:
@@ -1749,7 +1749,7 @@ class CheckIntegrity(object):
for handle in self.db.person_map.keys():
self.progress.step()
info = self.db.person_map[handle]
- person = gen.lib.Person()
+ person = Person()
person.unserialize(info)
handle_list = person.get_referenced_handles_recursively()
for item in handle_list:
@@ -1765,7 +1765,7 @@ class CheckIntegrity(object):
for handle in self.db.family_map.keys():
self.progress.step()
info = self.db.family_map[handle]
- family = gen.lib.Family()
+ family = Family()
family.unserialize(info)
handle_list = family.get_referenced_handles_recursively()
for item in handle_list:
@@ -1781,7 +1781,7 @@ class CheckIntegrity(object):
for handle in self.db.media_map.keys():
self.progress.step()
info = self.db.media_map[handle]
- obj = gen.lib.MediaObject()
+ obj = MediaObject()
obj.unserialize(info)
handle_list = obj.get_referenced_handles_recursively()
for item in handle_list:
@@ -1797,7 +1797,7 @@ class CheckIntegrity(object):
for handle in self.db.note_map.keys():
self.progress.step()
info = self.db.note_map[handle]
- note = gen.lib.Note()
+ note = Note()
note.unserialize(info)
handle_list = note.get_referenced_handles_recursively()
for item in handle_list:
@@ -1818,7 +1818,7 @@ class CheckIntegrity(object):
logging.info(' OK: no tag reference problems found')
def class_person(self, handle):
- person = gen.lib.Person()
+ person = Person()
person.set_handle(handle)
return person
@@ -1826,7 +1826,7 @@ class CheckIntegrity(object):
self.db.add_person(person, trans, set_gid=True)
def class_family(self, handle):
- family = gen.lib.Family()
+ family = Family()
family.set_handle(handle)
return family
@@ -1834,7 +1834,7 @@ class CheckIntegrity(object):
self.db.add_family(family, trans, set_gid=True)
def class_event(self, handle):
- event = gen.lib.Event()
+ event = Event()
event.set_handle(handle)
return event
@@ -1842,7 +1842,7 @@ class CheckIntegrity(object):
self.db.add_event(event, trans, set_gid=True)
def class_place(self, handle):
- place = gen.lib.Place()
+ place = Place()
place.set_handle(handle)
return place
@@ -1850,7 +1850,7 @@ class CheckIntegrity(object):
self.db.add_place(place, trans, set_gid=True)
def class_source(self, handle):
- source = gen.lib.Source()
+ source = Source()
source.set_handle(handle)
return source
@@ -1858,7 +1858,7 @@ class CheckIntegrity(object):
self.db.add_source(source, trans, set_gid=True)
def class_citation(self, handle):
- citation = gen.lib.Citation()
+ citation = Citation()
citation.set_handle(handle)
return citation
@@ -1866,7 +1866,7 @@ class CheckIntegrity(object):
self.db.add_citation(citation, trans, set_gid=True)
def class_repo(self, handle):
- repo = gen.lib.Repository()
+ repo = Repository()
repo.set_handle(handle)
return repo
@@ -1874,7 +1874,7 @@ class CheckIntegrity(object):
self.db.add_repository(repo, trans, set_gid=True)
def class_object(self, handle):
- object = gen.lib.MediaObject()
+ object = MediaObject()
object.set_handle(handle)
return object
@@ -1882,7 +1882,7 @@ class CheckIntegrity(object):
self.db.add_object(object, trans, set_gid=True)
def class_note(self, handle):
- note = gen.lib.Note()
+ note = Note()
note.set_handle(handle)
return note
@@ -1890,7 +1890,7 @@ class CheckIntegrity(object):
self.db.add_note(note, trans, set_gid=True)
def class_tag(self, handle):
- tag = gen.lib.Tag()
+ tag = Tag()
tag.set_handle(handle)
return tag
diff --git a/gramps/plugins/tool/dateparserdisplaytest.py b/gramps/plugins/tool/dateparserdisplaytest.py
index a6febaad1..13a259021 100644
--- a/gramps/plugins/tool/dateparserdisplaytest.py
+++ b/gramps/plugins/tool/dateparserdisplaytest.py
@@ -43,7 +43,7 @@ from gen.ggettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Date, Event, EventRef, EventType, Name, Person, Surname, Tag
from gen.db import DbTxn
from gui.plug import tool
from gui.utils import ProgressMeter
@@ -74,37 +74,37 @@ class DateParserDisplayTest(tool.Tool):
4)
dates = []
# first some valid dates
- calendar = gen.lib.Date.CAL_GREGORIAN
- for quality in (gen.lib.Date.QUAL_NONE, gen.lib.Date.QUAL_ESTIMATED,
- gen.lib.Date.QUAL_CALCULATED):
- for modifier in (gen.lib.Date.MOD_NONE, gen.lib.Date.MOD_BEFORE,
- gen.lib.Date.MOD_AFTER, gen.lib.Date.MOD_ABOUT):
+ calendar = Date.CAL_GREGORIAN
+ for quality in (Date.QUAL_NONE, Date.QUAL_ESTIMATED,
+ Date.QUAL_CALCULATED):
+ for modifier in (Date.MOD_NONE, Date.MOD_BEFORE,
+ Date.MOD_AFTER, Date.MOD_ABOUT):
for slash1 in (False,True):
for month in range(1,13):
for day in (5,27):
- d = gen.lib.Date()
+ d = Date()
d.set(quality,modifier,calendar,(day,month,1789,slash1),"Text comment")
dates.append( d)
- for modifier in (gen.lib.Date.MOD_RANGE, gen.lib.Date.MOD_SPAN):
+ for modifier in (Date.MOD_RANGE, Date.MOD_SPAN):
for slash1 in (False,True):
for slash2 in (False,True):
for month in range(1,13):
for day in (5,27):
- d = gen.lib.Date()
+ d = Date()
d.set(quality,modifier,calendar,(day,month,1789,slash1,day,month,1876,slash2),"Text comment")
dates.append( d)
- d = gen.lib.Date()
+ d = Date()
d.set(quality,modifier,calendar,(day,month,1789,slash1,day,13-month,1876,slash2),"Text comment")
dates.append( d)
- d = gen.lib.Date()
+ d = Date()
d.set(quality,modifier,calendar,(day,month,1789,slash1,32-day,month,1876,slash2),"Text comment")
dates.append( d)
- d = gen.lib.Date()
+ d = Date()
d.set(quality,modifier,calendar,(day,month,1789,slash1,32-day,13-month,1876,slash2),"Text comment")
dates.append( d)
- modifier = gen.lib.Date.MOD_TEXTONLY
- d = gen.lib.Date()
- d.set(quality,modifier,calendar,gen.lib.Date.EMPTY,
+ modifier = Date.MOD_TEXTONLY
+ d = Date()
+ d.set(quality,modifier,calendar,Date.EMPTY,
"This is a textual date")
dates.append( d)
self.progress.step()
@@ -112,47 +112,47 @@ class DateParserDisplayTest(tool.Tool):
# test invalid dates
#dateval = (4,7,1789,False,5,8,1876,False)
#for l in range(1,len(dateval)):
- # d = gen.lib.Date()
+ # d = Date()
# try:
- # d.set(gen.lib.Date.QUAL_NONE,gen.lib.Date.MOD_NONE,
- # gen.lib.Date.CAL_GREGORIAN,dateval[:l],"Text comment")
+ # d.set(Date.QUAL_NONE,Date.MOD_NONE,
+ # Date.CAL_GREGORIAN,dateval[:l],"Text comment")
# dates.append( d)
# except DateError, e:
# d.set_as_text("Date identified value correctly as invalid.\n%s" % e)
# dates.append( d)
# except:
- # d = gen.lib.Date()
+ # d = Date()
# d.set_as_text("Date.set Exception %s" % ("".join(traceback.format_exception(*sys.exc_info())),))
# dates.append( d)
#for l in range(1,len(dateval)):
- # d = gen.lib.Date()
+ # d = Date()
# try:
- # d.set(gen.lib.Date.QUAL_NONE,gen.lib.Date.MOD_SPAN,gen.lib.Date.CAL_GREGORIAN,dateval[:l],"Text comment")
+ # d.set(Date.QUAL_NONE,Date.MOD_SPAN,Date.CAL_GREGORIAN,dateval[:l],"Text comment")
# dates.append( d)
# except DateError, e:
# d.set_as_text("Date identified value correctly as invalid.\n%s" % e)
# dates.append( d)
# except:
- # d = gen.lib.Date()
+ # d = Date()
# d.set_as_text("Date.set Exception %s" % ("".join(traceback.format_exception(*sys.exc_info())),))
# dates.append( d)
#self.progress.step()
- #d = gen.lib.Date()
- #d.set(gen.lib.Date.QUAL_NONE,gen.lib.Date.MOD_NONE,
- # gen.lib.Date.CAL_GREGORIAN,(44,7,1789,False),"Text comment")
+ #d = Date()
+ #d.set(Date.QUAL_NONE,Date.MOD_NONE,
+ # Date.CAL_GREGORIAN,(44,7,1789,False),"Text comment")
#dates.append( d)
- #d = gen.lib.Date()
- #d.set(gen.lib.Date.QUAL_NONE,gen.lib.Date.MOD_NONE,
- # gen.lib.Date.CAL_GREGORIAN,(4,77,1789,False),"Text comment")
+ #d = Date()
+ #d.set(Date.QUAL_NONE,Date.MOD_NONE,
+ # Date.CAL_GREGORIAN,(4,77,1789,False),"Text comment")
#dates.append( d)
- #d = gen.lib.Date()
- #d.set(gen.lib.Date.QUAL_NONE,gen.lib.Date.MOD_SPAN,
- # gen.lib.Date.CAL_GREGORIAN,
+ #d = Date()
+ #d.set(Date.QUAL_NONE,Date.MOD_SPAN,
+ # Date.CAL_GREGORIAN,
# (4,7,1789,False,55,8,1876,False),"Text comment")
#dates.append( d)
- #d = gen.lib.Date()
- #d.set(gen.lib.Date.QUAL_NONE,gen.lib.Date.MOD_SPAN,
- # gen.lib.Date.CAL_GREGORIAN,
+ #d = Date()
+ #d.set(Date.QUAL_NONE,Date.MOD_SPAN,
+ # Date.CAL_GREGORIAN,
# (4,7,1789,False,5,88,1876,False),"Text comment")
#dates.append( d)
@@ -168,20 +168,20 @@ class DateParserDisplayTest(tool.Tool):
# now add them as birth to new persons
i = 1
for dateval in dates:
- person = gen.lib.Person()
- surname = gen.lib.Surname()
+ person = Person()
+ surname = Surname()
surname.set_surname("DateTest")
- name = gen.lib.Name()
+ name = Name()
name.add_surname(surname)
name.set_first_name("Test %d" % i)
person.set_primary_name(name)
self.db.add_person(person, self.trans)
- bevent = gen.lib.Event()
- bevent.set_type(gen.lib.EventType.BIRTH)
+ bevent = Event()
+ bevent.set_type(EventType.BIRTH)
bevent.set_date_object(dateval)
bevent.set_description("Date Test %d (source)" % i)
bevent_h = self.db.add_event(bevent, self.trans)
- bevent_ref = gen.lib.EventRef()
+ bevent_ref = EventRef()
bevent_ref.set_reference_handle(bevent_h)
# for the death event display the date as text and parse it back to a new date
ndate = None
@@ -190,38 +190,38 @@ class DateParserDisplayTest(tool.Tool):
try:
ndate = _dp.parse( datestr)
if not ndate:
- ndate = gen.lib.Date()
+ ndate = Date()
ndate.set_as_text("DateParser None")
person.add_tag(fail_handle)
else:
person.add_tag(pass_handle)
except:
- ndate = gen.lib.Date()
+ ndate = Date()
ndate.set_as_text("DateParser Exception %s" % ("".join(traceback.format_exception(*sys.exc_info())),))
person.add_tag(fail_handle)
else:
person.add_tag(pass_handle)
except:
- ndate = gen.lib.Date()
+ ndate = Date()
ndate.set_as_text("DateDisplay Exception: %s" % ("".join(traceback.format_exception(*sys.exc_info())),))
person.add_tag(fail_handle)
- if dateval.get_modifier() != gen.lib.Date.MOD_TEXTONLY \
- and ndate.get_modifier() == gen.lib.Date.MOD_TEXTONLY:
+ if dateval.get_modifier() != Date.MOD_TEXTONLY \
+ and ndate.get_modifier() == Date.MOD_TEXTONLY:
# parser was unable to correctly parse the string
ndate.set_as_text( "TEXTONLY: "+ndate.get_text())
person.add_tag(fail_handle)
- if dateval.get_modifier() == gen.lib.Date.MOD_TEXTONLY \
+ if dateval.get_modifier() == Date.MOD_TEXTONLY \
and dateval.get_text().count("Traceback") \
and pass_handle in person.get_tag_list():
person.add_tag(fail_handle)
- devent = gen.lib.Event()
- devent.set_type(gen.lib.EventType.DEATH)
+ devent = Event()
+ devent.set_type(EventType.DEATH)
devent.set_date_object(ndate)
devent.set_description("Date Test %d (result)" % i)
devent_h = self.db.add_event(devent, self.trans)
- devent_ref = gen.lib.EventRef()
+ devent_ref = EventRef()
devent_ref.set_reference_handle(devent_h)
person.set_birth_ref(bevent_ref)
person.set_death_ref(devent_ref)
@@ -238,7 +238,7 @@ class DateParserDisplayTest(tool.Tool):
"""
tag = self.db.get_tag_from_name(tag_name)
if tag is None:
- tag = gen.lib.Tag()
+ tag = Tag()
tag.set_name(tag_name)
if tag_color is not None:
tag.set_color(tag_color)
diff --git a/gramps/plugins/tool/eventnames.py b/gramps/plugins/tool/eventnames.py
index a2b37f90c..8590db5bc 100644
--- a/gramps/plugins/tool/eventnames.py
+++ b/gramps/plugins/tool/eventnames.py
@@ -44,7 +44,7 @@ from gen.ggettext import ngettext
#
#-------------------------------------------------------------------------
from gui.managedwindow import ManagedWindow
-import gen.lib
+from gramps.gen.lib import EventRoleType
from gen.db import DbTxn
from gen.utils.db import family_name
@@ -86,7 +86,7 @@ class EventNames(tool.BatchTool, ManagedWindow):
for person in self.db.iter_people():
for event_ref in person.get_event_ref_list():
- if event_ref.get_role() == gen.lib.EventRoleType.PRIMARY:
+ if event_ref.get_role() == EventRoleType.PRIMARY:
event_handle = event_ref.ref
event = self.db.get_event_from_handle(event_handle)
if event.get_description() == "":
@@ -97,7 +97,7 @@ class EventNames(tool.BatchTool, ManagedWindow):
for family in self.db.iter_families():
for event_ref in family.get_event_ref_list():
- if event_ref.get_role() == gen.lib.EventRoleType.FAMILY:
+ if event_ref.get_role() == EventRoleType.FAMILY:
event_handle = event_ref.ref
event = self.db.get_event_from_handle(event_handle)
if event.get_description() == "":
diff --git a/gramps/plugins/tool/finddupes.py b/gramps/plugins/tool/finddupes.py
index eda71c24e..6fb94193f 100644
--- a/gramps/plugins/tool/finddupes.py
+++ b/gramps/plugins/tool/finddupes.py
@@ -37,7 +37,7 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gen.const import URL_MANUAL_PAGE
-import gen.lib
+from gramps.gen.lib import Event, Person
from gui.utils import ProgressMeter
from gui.plug import tool
from gen.soundex import soundex, compare
@@ -202,7 +202,7 @@ class Merge(tool.Tool,ManagedWindow):
self.progress.step()
p1 = self.db.get_person_from_handle(p1_id)
key = self.gen_key(get_surnames(p1.get_primary_name()))
- if p1.get_gender() == gen.lib.Person.MALE:
+ if p1.get_gender() == Person.MALE:
if key in males:
males[key].append(p1_id)
else:
@@ -221,7 +221,7 @@ class Merge(tool.Tool,ManagedWindow):
p1 = self.db.get_person_from_handle(p1key)
key = self.gen_key(get_surnames(p1.get_primary_name()))
- if p1.get_gender() == gen.lib.Person.MALE:
+ if p1.get_gender() == Person.MALE:
remaining = males[key]
else:
remaining = females[key]
@@ -272,25 +272,25 @@ class Merge(tool.Tool,ManagedWindow):
if birth1_ref:
birth1 = self.db.get_event_from_handle(birth1_ref.ref)
else:
- birth1 = gen.lib.Event()
+ birth1 = Event()
death1_ref = p1.get_death_ref()
if death1_ref:
death1 = self.db.get_event_from_handle(death1_ref.ref)
else:
- death1 = gen.lib.Event()
+ death1 = Event()
birth2_ref = p2.get_birth_ref()
if birth2_ref:
birth2 = self.db.get_event_from_handle(birth2_ref.ref)
else:
- birth2 = gen.lib.Event()
+ birth2 = Event()
death2_ref = p2.get_death_ref()
if death2_ref:
death2 = self.db.get_event_from_handle(death2_ref.ref)
else:
- death2 = gen.lib.Event()
+ death2 = Event()
value = self.date_match(birth1.get_date_object(),
birth2.get_date_object())
@@ -371,7 +371,7 @@ class Merge(tool.Tool,ManagedWindow):
f1 = self.db.get_family_from_handle(f1_id)
for f2_id in p2.get_family_handle_list():
f2 = self.db.get_family_from_handle(f2_id)
- if p1.get_gender() == gen.lib.Person.FEMALE:
+ if p1.get_gender() == Person.FEMALE:
father1_id = f1.get_father_handle()
father2_id = f2.get_father_handle()
if father1_id and father2_id:
diff --git a/gramps/plugins/tool/patchnames.py b/gramps/plugins/tool/patchnames.py
index 3866b0755..49963f510 100644
--- a/gramps/plugins/tool/patchnames.py
+++ b/gramps/plugins/tool/patchnames.py
@@ -50,7 +50,7 @@ from gui.plug import tool
from gui.dialog import OkDialog
from gui.managedwindow import ManagedWindow
from gui.display import display_help
-import gen.lib
+from gramps.gen.lib import NameOriginType, Surname
from gen.db import DbTxn
from gen.ggettext import sgettext as _
from gui.glade import Glade
@@ -244,7 +244,7 @@ class PatchNames(tool.BatchTool, ManagedWindow):
primaries[0] = True
origs = []
for ind in range(len(prefixes)):
- origs.append(gen.lib.NameOriginType())
+ origs.append(NameOriginType())
origs[0] = old_orig[0]
compoundval = (surnames, prefixes, ['']*len(prefixes),
primaries, origs)
@@ -340,7 +340,7 @@ class PatchNames(tool.BatchTool, ManagedWindow):
pref=''
con = ''
prim = False
- orig = gen.lib.NameOriginType()
+ orig = NameOriginType()
ind += 1
if found:
compoundval = (new_surname_list, new_prefix_list,
@@ -524,7 +524,7 @@ class PatchNames(tool.BatchTool, ManagedWindow):
new_surn_list = []
for surn, pref, con, prim, orig in zip(surns, prefs, cons,
prims, origs):
- new_surn_list.append(gen.lib.Surname())
+ new_surn_list.append(Surname())
new_surn_list[-1].set_surname(surn.strip())
new_surn_list[-1].set_prefix(pref.strip())
new_surn_list[-1].set_connector(con.strip())
diff --git a/gramps/plugins/tool/populatesources.py b/gramps/plugins/tool/populatesources.py
index d667d6d7a..8d4137f68 100644
--- a/gramps/plugins/tool/populatesources.py
+++ b/gramps/plugins/tool/populatesources.py
@@ -46,7 +46,7 @@ from gui.utils import ProgressMeter
from gui.plug import tool
from gui.dialog import OkDialog
from gui.managedwindow import ManagedWindow
-import gen.lib
+from gramps.gen.lib import Citation, Source
from gen.db import DbTxn
class PopulateSources(tool.Tool, ManagedWindow):
@@ -136,8 +136,8 @@ class PopulateSources(tool.Tool, ManagedWindow):
LOG.debug("sources %04d citations %04d" % (num_sources,
num_citations))
- source = gen.lib.Source()
- citation = gen.lib.Citation()
+ source = Source()
+ citation = Citation()
self.db.disable_signals()
with DbTxn('Populate sources and citations', self.db) as trans:
diff --git a/gramps/plugins/tool/reorderids.py b/gramps/plugins/tool/reorderids.py
index 59e2c5e93..d624d6ec9 100644
--- a/gramps/plugins/tool/reorderids.py
+++ b/gramps/plugins/tool/reorderids.py
@@ -41,7 +41,7 @@ from gen.ggettext import gettext as _
#
#------------------------------------------------------------------------
from gui.utils import ProgressMeter
-import gen.lib
+from gramps.gen.lib import Event, Family, MediaObject, Note, Person, Place, Repository, Source
from gen.db import DbTxn
from gui.plug import tool
@@ -74,7 +74,7 @@ class ReorderIds(tool.BatchTool):
if uistate:
self.progress.set_pass(_('Reordering People IDs'),
db.get_number_of_people())
- self.reorder(gen.lib.Person,
+ self.reorder(Person,
db.get_person_from_gramps_id,
db.get_person_from_handle,
db.find_next_person_gramps_id,
@@ -85,7 +85,7 @@ class ReorderIds(tool.BatchTool):
if uistate:
self.progress.set_pass(_('Reordering Family IDs'),
db.get_number_of_families())
- self.reorder(gen.lib.Family,
+ self.reorder(Family,
db.get_family_from_gramps_id,
db.get_family_from_handle,
db.find_next_family_gramps_id,
@@ -95,7 +95,7 @@ class ReorderIds(tool.BatchTool):
if uistate:
self.progress.set_pass(_('Reordering Event IDs'),
db.get_number_of_events())
- self.reorder(gen.lib.Event,
+ self.reorder(Event,
db.get_event_from_gramps_id,
db.get_event_from_handle,
db.find_next_event_gramps_id,
@@ -105,7 +105,7 @@ class ReorderIds(tool.BatchTool):
if uistate:
self.progress.set_pass(_('Reordering Media Object IDs'),
db.get_number_of_media_objects())
- self.reorder(gen.lib.MediaObject,
+ self.reorder(MediaObject,
db.get_object_from_gramps_id,
db.get_object_from_handle,
db.find_next_object_gramps_id,
@@ -115,7 +115,7 @@ class ReorderIds(tool.BatchTool):
if uistate:
self.progress.set_pass(_('Reordering Source IDs'),
db.get_number_of_sources())
- self.reorder(gen.lib.Source,
+ self.reorder(Source,
db.get_source_from_gramps_id,
db.get_source_from_handle,
db.find_next_source_gramps_id,
@@ -125,7 +125,7 @@ class ReorderIds(tool.BatchTool):
if uistate:
self.progress.set_pass(_('Reordering Place IDs'),
db.get_number_of_places())
- self.reorder(gen.lib.Place,
+ self.reorder(Place,
db.get_place_from_gramps_id,
db.get_place_from_handle,
db.find_next_place_gramps_id,
@@ -135,7 +135,7 @@ class ReorderIds(tool.BatchTool):
if uistate:
self.progress.set_pass(_('Reordering Repository IDs'),
db.get_number_of_repositories())
- self.reorder(gen.lib.Repository,
+ self.reorder(Repository,
db.get_repository_from_gramps_id,
db.get_repository_from_handle,
db.find_next_repository_gramps_id,
@@ -146,7 +146,7 @@ class ReorderIds(tool.BatchTool):
if uistate:
self.progress.set_pass(_('Reordering Note IDs'),
db.get_number_of_notes())
- self.reorder(gen.lib.Note,
+ self.reorder(Note,
db.get_note_from_gramps_id,
db.get_note_from_handle,
db.find_next_note_gramps_id,
diff --git a/gramps/plugins/tool/testcasegenerator.py b/gramps/plugins/tool/testcasegenerator.py
index e5519b0c9..437a1ead2 100644
--- a/gramps/plugins/tool/testcasegenerator.py
+++ b/gramps/plugins/tool/testcasegenerator.py
@@ -47,7 +47,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Address, Attribute, AttributeType, ChildRef, ChildRefType, Citation, Date, Event, EventRef, EventRoleType, EventType, Family, FamilyRelType, GrampsType, LdsOrd, Location, MediaObject, MediaRef, Name, NameOriginType, NameType, Note, NoteType, Person, PersonRef, Place, RepoRef, Repository, RepositoryType, Source, SourceMediaType, Surname, Tag, Url, UrlType
from gen.lib import StyledText, StyledTextTag, StyledTextTagType
from gen.db import DbTxn
import gen.mime
@@ -93,17 +93,17 @@ class TestcaseGenerator(tool.BatchTool):
# ]
FAMILY_EVENTS = set([
- gen.lib.EventType.ANNULMENT,
- gen.lib.EventType.CENSUS,
- gen.lib.EventType.DIVORCE,
- gen.lib.EventType.DIV_FILING,
- gen.lib.EventType.ENGAGEMENT,
- gen.lib.EventType.MARRIAGE,
- gen.lib.EventType.MARR_BANNS,
- gen.lib.EventType.MARR_CONTR,
- gen.lib.EventType.MARR_LIC,
- gen.lib.EventType.MARR_SETTL,
- gen.lib.EventType.CUSTOM ])
+ EventType.ANNULMENT,
+ EventType.CENSUS,
+ EventType.DIVORCE,
+ EventType.DIV_FILING,
+ EventType.ENGAGEMENT,
+ EventType.MARRIAGE,
+ EventType.MARR_BANNS,
+ EventType.MARR_CONTR,
+ EventType.MARR_LIC,
+ EventType.MARR_SETTL,
+ EventType.CUSTOM ])
def __init__(self, dbstate, uistate, options_class, name, callback=None):
self.person = None
@@ -332,17 +332,17 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
- o = gen.lib.Note()
+ o = Note()
o.set("dup 1" + self.rand_text(self.NOTE))
- o.set_format( choice( (gen.lib.Note.FLOWED,gen.lib.Note.FORMATTED)))
- o.set_type( self.rand_type(gen.lib.NoteType()))
+ o.set_format( choice( (Note.FLOWED,Note.FORMATTED)))
+ o.set_type( self.rand_type(NoteType()))
h = self.db.add_note(o, self.trans)
print "object %s, handle %s, Gramps_Id %s" % (o, o.handle,
o.gramps_id)
handle = o.get_handle()
- o = gen.lib.Source()
+ o = Source()
o.set_title("dup 2" + self.rand_text(self.SHORT))
if randint(0,1) == 1:
o.set_author( self.rand_text(self.SHORT))
@@ -364,14 +364,14 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
- m = gen.lib.MediaObject()
+ m = MediaObject()
self.fill_object(m)
m.set_description("leave this media object invalid description\x9f")
m.set_path("/tmp/click_on_keep_reference.png\x9f")
m.set_mime_type("image/png\x9f")
self.db.add_object(m, self.trans)
- m = gen.lib.MediaObject()
+ m = MediaObject()
self.fill_object(m)
m.set_description("reselect this media object invalid description\x9f")
m.set_path("/tmp/click_on_select_file.png\x9f")
@@ -380,25 +380,25 @@ class TestcaseGenerator(tool.BatchTool):
# setup media attached to Source and Citation to be removed
- m = gen.lib.MediaObject()
+ m = MediaObject()
self.fill_object(m)
m.set_description(u'remove this media object')
m.set_path(u"/tmp/click_on_remove_object.png")
m.set_mime_type("image/png")
self.db.add_object(m, self.trans)
- s = gen.lib.Source()
+ s = Source()
s.set_title(u'media should be removed from this source')
- r = gen.lib.MediaRef()
+ r = MediaRef()
r.set_reference_handle(m.handle)
s.add_media_reference(r)
self.db.add_source( s, self.trans)
- c = gen.lib.Citation()
+ c = Citation()
self.fill_object(c)
c.set_reference_handle(s.handle)
c.set_page(u'media should be removed from this citation')
- r = gen.lib.MediaRef()
+ r = MediaRef()
r.set_reference_handle(m.handle)
c.add_media_reference(r)
self.db.add_citation(c, self.trans)
@@ -410,10 +410,10 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
- o = gen.lib.Note()
+ o = Note()
o.set("This is a text note with a \x03 control character")
- o.set_format(choice( (gen.lib.Note.FLOWED,gen.lib.Note.FORMATTED)))
- o.set_type(self.rand_type(gen.lib.NoteType()))
+ o.set_format(choice( (Note.FLOWED,Note.FORMATTED)))
+ o.set_type(self.rand_type(NoteType()))
self.db.add_note(o, self.trans)
def test_cleanup_missing_photos(self):
@@ -428,31 +428,31 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
- p = gen.lib.Person()
+ p = Person()
self.db.add_person( p, self.trans)
- f = gen.lib.Family()
+ f = Family()
self.db.add_family( f, self.trans)
- e = gen.lib.Event()
+ e = Event()
self.db.add_event( e, self.trans)
- p = gen.lib.Place()
+ p = Place()
self.db.add_place( p, self.trans)
- s = gen.lib.Source()
+ s = Source()
self.db.add_source( s, self.trans)
- c = gen.lib.Citation()
+ c = Citation()
self.db.add_citation( c, self.trans)
- m = gen.lib.MediaObject()
+ m = MediaObject()
self.db.add_object( m, self.trans)
- r = gen.lib.Repository()
+ r = Repository()
self.db.add_repository( r, self.trans)
- n = gen.lib.Note()
+ n = Note()
self.db.add_note( n, self.trans)
def test_check_for_broken_family_links(self):
@@ -461,12 +461,12 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken1","Family links to this person, but person does not link back")
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken1",None)
- fam = gen.lib.Family()
+ person1_h = self.generate_person(Person.MALE,"Broken1","Family links to this person, but person does not link back")
+ person2_h = self.generate_person(Person.FEMALE,"Broken1",None)
+ fam = Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
+ fam.set_relationship((FamilyRelType.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
#person1 = self.db.get_person_from_handle(person1_h)
#person1.add_family_handle(fam_h)
@@ -479,12 +479,12 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken2",None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken2",None)
- fam = gen.lib.Family()
+ person1_h = self.generate_person(Person.MALE,"Broken2",None)
+ person2_h = self.generate_person(Person.FEMALE,"Broken2",None)
+ fam = Family()
#fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
+ fam.set_relationship((FamilyRelType.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@@ -497,12 +497,12 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken3",None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken3",None)
- fam = gen.lib.Family()
+ person1_h = self.generate_person(Person.MALE,"Broken3",None)
+ person2_h = self.generate_person(Person.FEMALE,"Broken3",None)
+ fam = Family()
fam.set_father_handle(person1_h)
#fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
+ fam.set_relationship((FamilyRelType.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@@ -516,12 +516,12 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken4",None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken4","Family links to this person, but person does not link back")
- fam = gen.lib.Family()
+ person1_h = self.generate_person(Person.MALE,"Broken4",None)
+ person2_h = self.generate_person(Person.FEMALE,"Broken4","Family links to this person, but person does not link back")
+ fam = Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
+ fam.set_relationship((FamilyRelType.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@@ -535,12 +535,12 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken5",None)
- person2_h = self.generate_person(gen.lib.Person.MALE,"Broken5",None)
- fam = gen.lib.Family()
+ person1_h = self.generate_person(Person.MALE,"Broken5",None)
+ person2_h = self.generate_person(Person.MALE,"Broken5",None)
+ fam = Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
+ fam.set_relationship((FamilyRelType.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@@ -553,12 +553,12 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- #person1_h = self.generate_person(gen.lib.Person.MALE,"Broken6",None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken6",None)
- fam = gen.lib.Family()
+ #person1_h = self.generate_person(Person.MALE,"Broken6",None)
+ person2_h = self.generate_person(Person.FEMALE,"Broken6",None)
+ fam = Family()
fam.set_father_handle("InvalidHandle1")
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
+ fam.set_relationship((FamilyRelType.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
#person1 = self.db.get_person_from_handle(person1_h)
#person1.add_family_handle(fam_h)
@@ -571,12 +571,12 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken7",None)
- #person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken7",None)
- fam = gen.lib.Family()
+ person1_h = self.generate_person(Person.MALE,"Broken7",None)
+ #person2_h = self.generate_person(Person.FEMALE,"Broken7",None)
+ fam = Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle("InvalidHandle2")
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
+ fam.set_relationship((FamilyRelType.MARRIED,''))
fam_h = self.db.add_family(fam,self.trans)
person1 = self.db.get_person_from_handle(person1_h)
person1.add_family_handle(fam_h)
@@ -589,14 +589,14 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken8",None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken8",None)
+ person1_h = self.generate_person(Person.MALE,"Broken8",None)
+ person2_h = self.generate_person(Person.FEMALE,"Broken8",None)
child_h = self.generate_person(None,"Broken8",None)
- fam = gen.lib.Family()
+ fam = Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
- child_ref = gen.lib.ChildRef()
+ fam.set_relationship((FamilyRelType.MARRIED,''))
+ child_ref = ChildRef()
child_ref.set_reference_handle(child_h)
self.fill_object(child_ref)
fam.add_child_ref(child_ref)
@@ -615,14 +615,14 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken9",None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken9",None)
+ person1_h = self.generate_person(Person.MALE,"Broken9",None)
+ person2_h = self.generate_person(Person.FEMALE,"Broken9",None)
child_h = self.generate_person(None,"Broken9",None)
- fam = gen.lib.Family()
+ fam = Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
- # child_ref = gen.lib.ChildRef()
+ fam.set_relationship((FamilyRelType.MARRIED,''))
+ # child_ref = ChildRef()
# child_ref.set_reference_handle(child_h)
# self.fill_object(child_ref)
# fam.add_child_ref(child_ref)
@@ -641,14 +641,14 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken19",None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken19",None)
+ person1_h = self.generate_person(Person.MALE,"Broken19",None)
+ person2_h = self.generate_person(Person.FEMALE,"Broken19",None)
child_h = person2_h
- fam = gen.lib.Family()
+ fam = Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
- child_ref = gen.lib.ChildRef()
+ fam.set_relationship((FamilyRelType.MARRIED,''))
+ child_ref = ChildRef()
child_ref.set_reference_handle(child_h)
self.fill_object(child_ref)
fam.add_child_ref(child_ref)
@@ -668,13 +668,13 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- person1_h = self.generate_person(gen.lib.Person.MALE,"Broken20",None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,"Broken20",None)
-# fam = gen.lib.Family()
+ person1_h = self.generate_person(Person.MALE,"Broken20",None)
+ person2_h = self.generate_person(Person.FEMALE,"Broken20",None)
+# fam = Family()
# fam.set_father_handle(person1_h)
# fam.set_mother_handle(person2_h)
-# fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
-# child_ref = gen.lib.ChildRef()
+# fam.set_relationship((FamilyRelType.MARRIED,''))
+# child_ref = ChildRef()
# # child_ref.set_reference_handle(child_h)
# # self.fill_object(child_ref)
# # fam.add_child_ref(child_ref)
@@ -705,7 +705,7 @@ class TestcaseGenerator(tool.BatchTool):
self.transaction_count += 1
person_h = self.generate_person(None,"Broken11",None)
person = self.db.get_person_from_handle(person_h)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle("InvalidHandle4")
person.set_birth_ref(event_ref)
self.db.commit_person(person,self.trans)
@@ -716,7 +716,7 @@ class TestcaseGenerator(tool.BatchTool):
self.transaction_count += 1
person_h = self.generate_person(None,"Broken12",None)
person = self.db.get_person_from_handle(person_h)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle("InvalidHandle5")
person.set_death_ref(event_ref)
self.db.commit_person(person,self.trans)
@@ -727,7 +727,7 @@ class TestcaseGenerator(tool.BatchTool):
self.transaction_count += 1
person_h = self.generate_person(None,"Broken13",None)
person = self.db.get_person_from_handle(person_h)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle("InvalidHandle6")
person.add_event_ref(event_ref)
self.db.commit_person(person,self.trans)
@@ -737,12 +737,12 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
person_h = self.generate_person(None,"Broken14",None)
- event = gen.lib.Event()
+ event = Event()
# The default type _DEFAULT = BIRTH is set in eventtype
event.set_type('')
event.set_description("Test for Broken14")
event_h = self.db.add_event(event,self.trans)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(event_h)
person = self.db.get_person_from_handle(person_h)
person.set_birth_ref(event_ref)
@@ -753,12 +753,12 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
person_h = self.generate_person(None,"Broken15",None)
- event = gen.lib.Event()
+ event = Event()
# The default type _DEFAULT = BIRTH is set in eventtype
event.set_type('')
event.set_description("Test for Broken15")
event_h = self.db.add_event(event,self.trans)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(event_h)
person = self.db.get_person_from_handle(person_h)
person.set_death_ref(event_ref)
@@ -770,12 +770,12 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
person_h = self.generate_person(None,"Broken16",None)
- event = gen.lib.Event()
+ event = Event()
# The default type _DEFAULT = BIRTH is set in eventtype
event.set_type('')
event.set_description("Test for Broken16")
event_h = self.db.add_event(event,self.trans)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(event_h)
person = self.db.get_person_from_handle(person_h)
person.add_event_ref(event_ref)
@@ -793,12 +793,12 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
person_h = self.generate_person(None,"Broken17",None)
- event = gen.lib.Event()
- event.set_type(gen.lib.EventType.BIRTH)
+ event = Event()
+ event.set_type(EventType.BIRTH)
event.set_place_handle("InvalidHandle7")
event.set_description("Test for Broken17")
event_h = self.db.add_event(event,self.trans)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(event_h)
person = self.db.get_person_from_handle(person_h)
person.set_birth_ref(event_ref)
@@ -809,12 +809,12 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
person_h = self.generate_person(None,"Broken18",None)
- event = gen.lib.Event()
- event.set_type(gen.lib.EventType.BIRTH)
+ event = Event()
+ event.set_type(EventType.BIRTH)
event.set_place_handle("InvalidHandle8")
event.set_description("Test for Broken18")
event_h = self.db.add_event(event,self.trans)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
event_ref.set_reference_handle(event_h)
person = self.db.get_person_from_handle(person_h)
person.add_event_ref(event_ref)
@@ -826,25 +826,25 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
- c = gen.lib.Citation()
+ c = Citation()
self.fill_object(c)
c.set_reference_handle("unknownsourcehandle")
c.set_page(u'unreferenced citation with invalid source ref')
self.db.add_citation(c, self.trans)
- c = gen.lib.Citation()
+ c = Citation()
self.fill_object(c)
c.set_reference_handle(None)
c.set_page(u'unreferenced citation with invalid source ref')
self.db.add_citation(c, self.trans)
- c = gen.lib.Citation()
+ c = Citation()
self.fill_object(c)
c.set_reference_handle("unknownsourcehandle")
c.set_page(u'citation and references to it should be removed')
c_h1 = self.db.add_citation(c, self.trans)
- c = gen.lib.Citation()
+ c = Citation()
self.fill_object(c)
c.set_reference_handle(None)
c.set_page(u'citation and references to it should be removed')
@@ -895,75 +895,75 @@ class TestcaseGenerator(tool.BatchTool):
#
# Repository (Repositories themselves do not have SourceRefs)
# Address
- m = gen.lib.MediaObject()
+ m = MediaObject()
m.set_description(message)
m.set_path(unicode(ICON))
m.set_mime_type(gen.mime.get_type(m.get_path()))
m.add_citation(choice(c_h_list))
# MediaObject : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(message)
a.add_citation(choice(c_h_list))
m.add_attribute(a)
self.db.add_object(m, self.trans)
- person1_h = self.generate_person(gen.lib.Person.MALE,name,None)
- person2_h = self.generate_person(gen.lib.Person.FEMALE,name,None)
+ person1_h = self.generate_person(Person.MALE,name,None)
+ person2_h = self.generate_person(Person.FEMALE,name,None)
child_h = self.generate_person(None,name,None)
- fam = gen.lib.Family()
+ fam = Family()
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- fam.set_relationship((gen.lib.FamilyRelType.MARRIED,''))
+ fam.set_relationship((FamilyRelType.MARRIED,''))
# Family
fam.add_citation(choice(c_h_list))
# Family : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(message)
a.add_citation(choice(c_h_list))
fam.add_attribute(a)
# Family : ChildRef
- child_ref = gen.lib.ChildRef()
+ child_ref = ChildRef()
child_ref.set_reference_handle(child_h)
self.fill_object(child_ref)
child_ref.add_citation(choice(c_h_list))
fam.add_child_ref(child_ref)
# Family : MediaRef
- mr = gen.lib.MediaRef()
+ mr = MediaRef()
mr.set_reference_handle(m.handle)
mr.add_citation(choice(c_h_list))
# Family : MediaRef : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(message)
a.add_citation(choice(c_h_list))
mr.add_attribute(a)
fam.add_media_reference(mr)
# Family : LDSORD
- ldsord = gen.lib.LdsOrd()
+ ldsord = LdsOrd()
self.fill_object( ldsord)
# TODO: adapt type and status to family/person
- #if isinstance(o,gen.lib.Person):
- #if isinstance(o,gen.lib.Family):
+ #if isinstance(o,Person):
+ #if isinstance(o,Family):
ldsord.set_type( choice(
- [item[0] for item in gen.lib.LdsOrd._TYPE_MAP] ))
- ldsord.set_status( randint(0,len(gen.lib.LdsOrd._STATUS_MAP)-1))
+ [item[0] for item in LdsOrd._TYPE_MAP] ))
+ ldsord.set_status( randint(0,len(LdsOrd._STATUS_MAP)-1))
ldsord.add_citation(choice(c_h_list))
fam.add_lds_ord(ldsord)
# Family : EventRef
- e = gen.lib.Event()
- e.set_type(gen.lib.EventType.MARRIAGE)
+ e = Event()
+ e.set_type(EventType.MARRIAGE)
(year, d) = self.rand_date()
e.set_date_object(d)
e.set_description(message)
event_h = self.db.add_event(e, self.trans)
- er = gen.lib.EventRef()
+ er = EventRef()
er.set_reference_handle(event_h)
- er.set_role(self.rand_type(gen.lib.EventRoleType()))
+ er.set_role(self.rand_type(EventRoleType()))
# Family : EventRef : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(message)
a.add_citation(choice(c_h_list))
er.add_attribute(a)
@@ -974,64 +974,64 @@ class TestcaseGenerator(tool.BatchTool):
# Person
person1.add_citation(choice(c_h_list))
# Person : Name
- alt_name = gen.lib.Name(person1.get_primary_name())
+ alt_name = Name(person1.get_primary_name())
alt_name.set_first_name(message)
alt_name.add_citation(choice(c_h_list))
person1.add_alternate_name(alt_name)
# Person : Address
- a = gen.lib.Address()
+ a = Address()
a.set_street(message)
a.add_citation(choice(c_h_list))
person1.add_address(a)
# Person : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(message)
a.add_citation(choice(c_h_list))
person1.add_attribute(a)
# Person : PersonRef
asso_h = self.generate_person()
- asso = gen.lib.PersonRef()
+ asso = PersonRef()
asso.set_reference_handle(asso_h)
asso.set_relation(self.rand_text(self.SHORT))
self.fill_object(asso)
asso.add_citation(choice(c_h_list))
person1.add_person_ref(asso)
# Person : MediaRef
- mr = gen.lib.MediaRef()
+ mr = MediaRef()
mr.set_reference_handle(m.handle)
mr.add_citation(choice(c_h_list))
# Person : MediaRef : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(self.rand_text(self.SHORT))
a.add_citation(choice(c_h_list))
mr.add_attribute(a)
person1.add_media_reference(mr)
# Person : LDSORD
- ldsord = gen.lib.LdsOrd()
+ ldsord = LdsOrd()
self.fill_object( ldsord)
# TODO: adapt type and status to family/person
- #if isinstance(o,gen.lib.Person):
- #if isinstance(o,gen.lib.Family):
+ #if isinstance(o,Person):
+ #if isinstance(o,Family):
ldsord.set_type( choice(
- [item[0] for item in gen.lib.LdsOrd._TYPE_MAP] ))
- ldsord.set_status( randint(0,len(gen.lib.LdsOrd._STATUS_MAP)-1))
+ [item[0] for item in LdsOrd._TYPE_MAP] ))
+ ldsord.set_status( randint(0,len(LdsOrd._STATUS_MAP)-1))
ldsord.add_citation(choice(c_h_list))
person1.add_lds_ord(ldsord)
# Person : EventRef
- e = gen.lib.Event()
- e.set_type(gen.lib.EventType.ELECTED)
+ e = Event()
+ e.set_type(EventType.ELECTED)
(year, d) = self.rand_date()
e.set_date_object(d)
e.set_description(message)
event_h = self.db.add_event(e, self.trans)
- er = gen.lib.EventRef()
+ er = EventRef()
er.set_reference_handle(event_h)
- er.set_role(self.rand_type(gen.lib.EventRoleType()))
+ er.set_role(self.rand_type(EventRoleType()))
# Person : EventRef : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(message)
a.add_citation(choice(c_h_list))
er.add_attribute(a)
@@ -1041,51 +1041,51 @@ class TestcaseGenerator(tool.BatchTool):
person2.add_family_handle(fam_h)
self.db.commit_person(person2,self.trans)
- e = gen.lib.Event()
+ e = Event()
e.set_description(message)
- e.set_type(gen.lib.EventType.MARRIAGE)
+ e.set_type(EventType.MARRIAGE)
# Event
e.add_citation(choice(c_h_list))
# Event : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(message)
a.add_citation(choice(c_h_list))
e.add_attribute(a)
# Event : MediaRef
- mr = gen.lib.MediaRef()
+ mr = MediaRef()
mr.set_reference_handle(m.handle)
mr.add_citation(choice(c_h_list))
# Event : MediaRef : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(self.rand_text(self.SHORT))
a.add_citation(choice(c_h_list))
mr.add_attribute(a)
e.add_media_reference(mr)
self.db.add_event(e, self.trans)
- p = gen.lib.Place()
+ p = Place()
p.set_title(message)
p.add_citation(choice(c_h_list))
# Place : MediaRef
- mr = gen.lib.MediaRef()
+ mr = MediaRef()
mr.set_reference_handle(m.handle)
mr.add_citation(choice(c_h_list))
# Place : MediaRef : Attribute
- a = gen.lib.Attribute()
- a.set_type(self.rand_type(gen.lib.AttributeType()))
+ a = Attribute()
+ a.set_type(self.rand_type(AttributeType()))
a.set_value(self.rand_text(self.SHORT))
a.add_citation(choice(c_h_list))
mr.add_attribute(a)
p.add_media_reference(mr)
self.db.add_place(p, self.trans)
- r = gen.lib.Repository()
+ r = Repository()
r.set_name(message)
- r.set_type(gen.lib.RepositoryType.LIBRARY)
+ r.set_type(RepositoryType.LIBRARY)
# Repository : Address
- a = gen.lib.Address()
+ a = Address()
a.set_street(message)
a.add_citation(choice(c_h_list))
r.add_address(a)
@@ -1107,22 +1107,22 @@ class TestcaseGenerator(tool.BatchTool):
while Gtk.events_pending():
Gtk.main_iteration()
- np = gen.lib.Person()
+ np = Person()
self.fill_object(np)
# Gender
if gender is None:
gender = randint(0,1)
if randint(0,10) == 1: # Set some persons to unknown gender
- np.set_gender(gen.lib.Person.UNKNOWN)
+ np.set_gender(Person.UNKNOWN)
else:
np.set_gender(gender)
# Name
- name = gen.lib.Name()
+ name = Name()
(firstname,lastname) = self.rand_name(lastname, gender)
name.set_first_name(firstname)
- surname = gen.lib.Surname()
+ surname = Surname()
surname.set_surname(lastname)
name.add_surname(surname)
self.fill_object( name)
@@ -1131,14 +1131,14 @@ class TestcaseGenerator(tool.BatchTool):
# generate some slightly different alternate name
firstname2 = firstname.replace("m", "n").replace("l", "i").replace("b", "d")
if firstname2 != firstname:
- alt_name = gen.lib.Name(name)
+ alt_name = Name(name)
self.fill_object( alt_name)
if randint(0,2) == 1:
- surname = gen.lib.Surname()
+ surname = Surname()
surname.set_surname(self.rand_text(self.LASTNAME))
alt_name.add_surname(surname)
elif randint(0,2) == 1:
- surname = gen.lib.Surname()
+ surname = Surname()
surname.set_surname(lastname)
alt_name.add_surname(surname)
if randint(0,1) == 1:
@@ -1146,9 +1146,9 @@ class TestcaseGenerator(tool.BatchTool):
if randint(0,1) == 1:
alt_name.set_title( self.rand_text(self.SHORT))
if randint(0,1) == 1:
- patronymic = gen.lib.Surname()
+ patronymic = Surname()
patronymic.set_surname( self.rand_text(self.FIRSTNAME_MALE))
- patronymic.set_origintype(gen.lib.NameOriginType.PATRONYMIC)
+ patronymic.set_origintype(NameOriginType.PATRONYMIC)
alt_name.add_surname(patronymic)
if randint(0,1) == 1:
alt_name.get_primary_surname().set_prefix( self.rand_text(self.SHORT))
@@ -1159,14 +1159,14 @@ class TestcaseGenerator(tool.BatchTool):
np.add_alternate_name( alt_name)
firstname2 = firstname.replace("a", "e").replace("o", "u").replace("r", "p")
if firstname2 != firstname:
- alt_name = gen.lib.Name(name)
+ alt_name = Name(name)
self.fill_object( alt_name)
if randint(0,2) == 1:
- surname = gen.lib.Surname()
+ surname = Surname()
surname.set_surname(self.rand_text(self.LASTNAME))
alt_name.add_surname(surname)
elif randint(0,2) == 1:
- surname = gen.lib.Surname()
+ surname = Surname()
surname.set_surname(lastname)
alt_name.add_surname(surname)
if randint(0,1) == 1:
@@ -1174,9 +1174,9 @@ class TestcaseGenerator(tool.BatchTool):
if randint(0,1) == 1:
alt_name.set_title( self.rand_text(self.SHORT))
if randint(0,1) == 1:
- patronymic = gen.lib.Surname()
+ patronymic = Surname()
patronymic.set_surname(self.rand_text(self.FIRSTNAME_MALE))
- patronymic.set_origintype(gen.lib.NameOriginType.PATRONYMIC)
+ patronymic.set_origintype(NameOriginType.PATRONYMIC)
alt_name.add_surname(patronymic)
if randint(0,1) == 1:
alt_name.get_primary_surname().set_prefix( self.rand_text(self.SHORT))
@@ -1194,25 +1194,25 @@ class TestcaseGenerator(tool.BatchTool):
# birth
if randint(0,1) == 1:
- (birth_year, eref) = self.rand_personal_event( gen.lib.EventType.BIRTH, by,by)
+ (birth_year, eref) = self.rand_personal_event( EventType.BIRTH, by,by)
np.set_birth_ref(eref)
# baptism
if randint(0,1) == 1:
(bapt_year, eref) = self.rand_personal_event(
- choice( (gen.lib.EventType.BAPTISM, gen.lib.EventType.CHRISTEN)), by, by+2)
+ choice( (EventType.BAPTISM, EventType.CHRISTEN)), by, by+2)
np.add_event_ref(eref)
# death
death_year = None
if randint(0,1) == 1:
- (death_year, eref) = self.rand_personal_event( gen.lib.EventType.DEATH, dy,dy)
+ (death_year, eref) = self.rand_personal_event( EventType.DEATH, dy,dy)
np.set_death_ref(eref)
# burial
if randint(0,1) == 1:
(bur_year, eref) = self.rand_personal_event(
- choice( (gen.lib.EventType.BURIAL, gen.lib.EventType.CREMATION)), dy, dy+2)
+ choice( (EventType.BURIAL, EventType.CREMATION)), dy, dy+2)
np.add_event_ref(eref)
# some other events
@@ -1224,7 +1224,7 @@ class TestcaseGenerator(tool.BatchTool):
if self.generated_events:
while randint(0,5) == 1:
e_h = choice(self.generated_events)
- eref = gen.lib.EventRef()
+ eref = EventRef()
self.fill_object( eref)
eref.set_reference_handle(e_h)
np.add_event_ref(eref)
@@ -1238,7 +1238,7 @@ class TestcaseGenerator(tool.BatchTool):
asso_h = self.generate_person(None, None, alive_in_year = alive_in_year)
else:
asso_h = self.generate_person()
- asso = gen.lib.PersonRef()
+ asso = PersonRef()
asso.set_reference_handle(asso_h)
asso.set_relation(self.rand_text(self.SHORT))
self.fill_object(asso)
@@ -1291,7 +1291,7 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- fam = gen.lib.Family()
+ fam = Family()
self.add_defaults(fam)
if person1_h:
fam.set_father_handle(person1_h)
@@ -1318,13 +1318,13 @@ class TestcaseGenerator(tool.BatchTool):
# some shared events
if self.generated_events:
while randint(0, 5) == 1:
- typeval = gen.lib.EventType.UNKNOWN
+ typeval = EventType.UNKNOWN
while int(typeval) not in self.FAMILY_EVENTS:
e_h = choice(self.generated_events)
typeval = self.db.get_event_from_handle(e_h).get_type()
if e_h in event_set:
break
- eref = gen.lib.EventRef()
+ eref = EventRef()
self.fill_object( eref)
eref.set_reference_handle(e_h)
fam.add_event_ref(eref)
@@ -1354,7 +1354,7 @@ class TestcaseGenerator(tool.BatchTool):
(born,died) = self.person_dates[child_h]
alive_in_year = born
fam = self.db.get_family_from_handle(fam_h)
- child_ref = gen.lib.ChildRef()
+ child_ref = ChildRef()
child_ref.set_reference_handle(child_h)
self.fill_object(child_ref)
fam.add_child_ref(child_ref)
@@ -1392,11 +1392,11 @@ class TestcaseGenerator(tool.BatchTool):
with DbTxn(_("Testcase generator step %d") % self.transaction_count,
self.db) as self.trans:
self.transaction_count += 1
- fam = gen.lib.Family()
+ fam = Family()
self.add_defaults(fam)
fam.set_father_handle(person1_h)
fam.set_mother_handle(person2_h)
- child_ref = gen.lib.ChildRef()
+ child_ref = ChildRef()
child_ref.set_reference_handle(child_h)
self.fill_object(child_ref)
fam.add_child_ref(child_ref)
@@ -1417,7 +1417,7 @@ class TestcaseGenerator(tool.BatchTool):
self.db) as self.trans:
self.transaction_count += 1
for counter in range(10):
- tag = gen.lib.Tag()
+ tag = Tag()
tag.set_name(self.rand_text(self.TAG))
tag.set_color(self.rand_color())
tag.set_priority(self.db.get_number_of_tags())
@@ -1428,9 +1428,9 @@ class TestcaseGenerator(tool.BatchTool):
self.fill_object( object)
def rand_name( self, lastname=None, gender=None):
- if gender == gen.lib.Person.MALE:
+ if gender == Person.MALE:
firstname = self.rand_text( self.FIRSTNAME_MALE)
- elif gender == gen.lib.Person.FEMALE:
+ elif gender == Person.FEMALE:
firstname = self.rand_text( self.FIRSTNAME_FEMALE)
else:
firstname = self.rand_text( self.FIRSTNAME)
@@ -1450,7 +1450,7 @@ class TestcaseGenerator(tool.BatchTool):
start = end - randint(0,100)
year = randint(start,end)
- ndate = gen.lib.Date()
+ ndate = Date()
if randint(0,10) == 1:
# Some get a textual date
ndate.set_as_text( choice((self.rand_text(self.SHORT),"Unknown","??","Don't know","TODO!")))
@@ -1460,23 +1460,23 @@ class TestcaseGenerator(tool.BatchTool):
pass
else:
# regular dates
- calendar = gen.lib.Date.CAL_GREGORIAN
- quality = choice( (gen.lib.Date.QUAL_NONE,
- gen.lib.Date.QUAL_ESTIMATED,
- gen.lib.Date.QUAL_CALCULATED))
- modifier = choice( (gen.lib.Date.MOD_NONE,
- gen.lib.Date.MOD_BEFORE,
- gen.lib.Date.MOD_AFTER,\
- gen.lib.Date.MOD_ABOUT,
- gen.lib.Date.MOD_RANGE,
- gen.lib.Date.MOD_SPAN))
+ calendar = Date.CAL_GREGORIAN
+ quality = choice( (Date.QUAL_NONE,
+ Date.QUAL_ESTIMATED,
+ Date.QUAL_CALCULATED))
+ modifier = choice( (Date.MOD_NONE,
+ Date.MOD_BEFORE,
+ Date.MOD_AFTER,\
+ Date.MOD_ABOUT,
+ Date.MOD_RANGE,
+ Date.MOD_SPAN))
day = randint(0,28)
if day > 0: # avoid days without month
month = randint(1,12)
else:
month = randint(0,12)
- if modifier in (gen.lib.Date.MOD_RANGE, gen.lib.Date.MOD_SPAN):
+ if modifier in (Date.MOD_RANGE, Date.MOD_SPAN):
day2 = randint(0,28)
if day2 > 0:
month2 = randint(1,12)
@@ -1494,63 +1494,63 @@ class TestcaseGenerator(tool.BatchTool):
if issubclass(o.__class__,gen.lib.addressbase.AddressBase):
while randint(0,1) == 1:
- a = gen.lib.Address()
+ a = Address()
self.fill_object(a)
o.add_address( a)
- if isinstance(o,gen.lib.Attribute):
- o.set_type( self.rand_type(gen.lib.AttributeType()))
+ if isinstance(o,Attribute):
+ o.set_type( self.rand_type(AttributeType()))
o.set_value( self.rand_text(self.SHORT))
if issubclass(o.__class__,gen.lib.attrbase.AttributeBase):
while randint(0,1) == 1:
- a = gen.lib.Attribute()
+ a = Attribute()
self.fill_object(a)
o.add_attribute( a)
- if isinstance(o,gen.lib.ChildRef):
+ if isinstance(o,ChildRef):
if randint(0,3) == 1:
- o.set_mother_relation( self.rand_type( gen.lib.ChildRefType()))
+ o.set_mother_relation( self.rand_type( ChildRefType()))
if randint(0,3) == 1:
- o.set_father_relation( self.rand_type( gen.lib.ChildRefType()))
+ o.set_father_relation( self.rand_type( ChildRefType()))
if issubclass(o.__class__,gen.lib.datebase.DateBase):
if randint(0,1) == 1:
(y,d) = self.rand_date()
o.set_date_object( d)
- if isinstance(o,gen.lib.Event):
+ if isinstance(o,Event):
if randint(0,1) == 1:
o.set_description( self.rand_text(self.LONG))
if issubclass(o.__class__,gen.lib.eventref.EventRef):
- o.set_role( self.rand_type(gen.lib.EventRoleType()))
+ o.set_role( self.rand_type(EventRoleType()))
- if isinstance(o,gen.lib.Family):
+ if isinstance(o,Family):
if randint(0,2) == 1:
- o.set_relationship( self.rand_type(gen.lib.FamilyRelType()))
+ o.set_relationship( self.rand_type(FamilyRelType()))
else:
- o.set_relationship(gen.lib.FamilyRelType(gen.lib.FamilyRelType.MARRIED))
+ o.set_relationship(FamilyRelType(FamilyRelType.MARRIED))
- if isinstance(o,gen.lib.LdsOrd):
+ if isinstance(o,LdsOrd):
if randint(0,1) == 1:
o.set_temple( choice(TEMPLES.name_code_data())[1])
if issubclass(o.__class__,gen.lib.ldsordbase.LdsOrdBase):
while randint(0,1) == 1:
- ldsord = gen.lib.LdsOrd()
+ ldsord = LdsOrd()
self.fill_object( ldsord)
# TODO: adapt type and status to family/person
- #if isinstance(o,gen.lib.Person):
- #if isinstance(o,gen.lib.Family):
+ #if isinstance(o,Person):
+ #if isinstance(o,Family):
ldsord.set_type( choice(
- [item[0] for item in gen.lib.LdsOrd._TYPE_MAP] ))
- ldsord.set_status( randint(0,len(gen.lib.LdsOrd._STATUS_MAP)-1))
+ [item[0] for item in LdsOrd._TYPE_MAP] ))
+ ldsord.set_status( randint(0,len(LdsOrd._STATUS_MAP)-1))
if self.generated_families:
ldsord.set_family_handle( choice(self.generated_families))
o.add_lds_ord( ldsord)
- if isinstance(o,gen.lib.Location):
+ if isinstance(o,Location):
if randint(0,1) == 1:
o.set_parish( self.rand_text(self.SHORT))
@@ -1573,9 +1573,9 @@ class TestcaseGenerator(tool.BatchTool):
if issubclass(o.__class__,gen.lib.mediabase.MediaBase):
# FIXME: frequency changed to prevent recursion
while randint(0,10) == 1:
- o.add_media_reference( self.fill_object( gen.lib.MediaRef()))
+ o.add_media_reference( self.fill_object( MediaRef()))
- if isinstance(o,gen.lib.MediaObject):
+ if isinstance(o,MediaObject):
if randint(0,3) == 1:
o.set_description(unicode(self.rand_text(self.LONG)))
path = choice((ICON, LOGO, SPLASH))
@@ -1587,9 +1587,9 @@ class TestcaseGenerator(tool.BatchTool):
o.set_path(unicode(ICON))
o.set_mime_type("image/png")
- if isinstance(o,gen.lib.MediaRef):
+ if isinstance(o,MediaRef):
if not self.generated_media or randint(0,10) == 1:
- m = gen.lib.MediaObject()
+ m = MediaObject()
self.fill_object(m)
self.db.add_object( m, self.trans)
self.generated_media.append( m.get_handle())
@@ -1597,14 +1597,14 @@ class TestcaseGenerator(tool.BatchTool):
if randint(0,1) == 1:
o.set_rectangle( (randint(0,200),randint(0,200),randint(0,200),randint(0,200)))
- if isinstance(o,gen.lib.Name):
- o.set_type( self.rand_type( gen.lib.NameType()))
+ if isinstance(o,Name):
+ o.set_type( self.rand_type( NameType()))
if randint(0,1) == 1:
o.set_title( self.rand_text(self.SHORT))
if randint(0,1) == 1:
- patronymic = gen.lib.Surname()
+ patronymic = Surname()
patronymic.set_surname(self.rand_text(self.FIRSTNAME_MALE))
- patronymic.set_origintype(gen.lib.NameOriginType.PATRONYMIC)
+ patronymic.set_origintype(NameOriginType.PATRONYMIC)
o.add_surname(patronymic)
if randint(0,1) == 1:
o.get_primary_surname().set_prefix( self.rand_text(self.SHORT))
@@ -1617,26 +1617,26 @@ class TestcaseGenerator(tool.BatchTool):
# o.set_display_as()
# o.set_sort_as()
- if isinstance(o,gen.lib.Note):
- type = self.rand_type(gen.lib.NoteType())
- if type == gen.lib.NoteType.HTML_CODE:
+ if isinstance(o,Note):
+ type = self.rand_type(NoteType())
+ if type == NoteType.HTML_CODE:
o.set( self.rand_text(self.NOTE))
else:
o.set_styledtext(self.rand_text(self.STYLED_TEXT))
- o.set_format( choice( (gen.lib.Note.FLOWED,gen.lib.Note.FORMATTED)))
+ o.set_format( choice( (Note.FLOWED,Note.FORMATTED)))
o.set_type(type)
if issubclass(o.__class__,gen.lib.notebase.NoteBase):
while randint(0,1) == 1:
if not self.generated_notes or randint(0,10) == 1:
- n = gen.lib.Note()
+ n = Note()
self.fill_object(n)
self.db.add_note( n, self.trans)
self.generated_notes.append( n.get_handle())
n_h = choice(self.generated_notes)
o.add_note(n_h)
- if isinstance(o,gen.lib.Place):
+ if isinstance(o,Place):
o.set_title( self.rand_text(self.SHORT))
if randint(0,1) == 1:
if randint(0,4) == 1:
@@ -1648,9 +1648,9 @@ class TestcaseGenerator(tool.BatchTool):
o.set_latitude( self.rand_text(self.SHORT))
else:
o.set_latitude( str(random()*180.0-90.0))
- o.set_main_location( self.fill_object( gen.lib.Location()))
+ o.set_main_location( self.fill_object( Location()))
while randint(0,1) == 1:
- o.add_alternate_locations( self.fill_object( gen.lib.Location()))
+ o.add_alternate_locations( self.fill_object( Location()))
if issubclass(o.__class__,gen.lib.placebase.PlaceBase):
if randint(0,1) == 1:
@@ -1663,22 +1663,22 @@ class TestcaseGenerator(tool.BatchTool):
if issubclass(o.__class__,gen.lib.privacybase.PrivacyBase):
o.set_privacy( randint(0,5) == 1)
- if isinstance(o,gen.lib.RepoRef):
+ if isinstance(o,RepoRef):
if not self.generated_repos or randint(0,10) == 1:
- r = gen.lib.Repository()
+ r = Repository()
self.fill_object(r)
self.db.add_repository( r, self.trans)
self.generated_repos.append(r.get_handle())
o.set_reference_handle( choice( self.generated_repos))
if randint(0,1) == 1:
o.set_call_number( self.rand_text(self.SHORT))
- o.set_media_type( self.rand_type(gen.lib.SourceMediaType()))
+ o.set_media_type( self.rand_type(SourceMediaType()))
- if isinstance(o,gen.lib.Repository):
- o.set_type( self.rand_type(gen.lib.RepositoryType()))
+ if isinstance(o,Repository):
+ o.set_type( self.rand_type(RepositoryType()))
o.set_name( self.rand_text(self.SHORT))
- if isinstance(o,gen.lib.Source):
+ if isinstance(o,Source):
o.set_title( self.rand_text(self.SHORT))
if randint(0,1) == 1:
o.set_author( self.rand_text(self.SHORT))
@@ -1689,23 +1689,23 @@ class TestcaseGenerator(tool.BatchTool):
while randint(0,1) == 1:
o.set_data_item( self.rand_text(self.SHORT), self.rand_text(self.SHORT))
while randint(0,1) == 1:
- r = gen.lib.RepoRef()
+ r = RepoRef()
self.fill_object(r)
o.add_repo_reference( r)
if issubclass(o.__class__,gen.lib.citationbase.CitationBase):
while randint(0,1) == 1:
if not self.generated_citations or randint(1,10) == 1:
- s = gen.lib.Citation()
+ s = Citation()
self.fill_object(s)
self.db.add_citation( s, self.trans)
self.generated_citations.append(s.get_handle())
s_h = choice(self.generated_citations)
o.add_citation(s_h)
- if isinstance(o,gen.lib.Citation):
+ if isinstance(o,Citation):
if not self.generated_sources or randint(0,10) == 1:
- s = gen.lib.Source()
+ s = Source()
self.fill_object(s)
self.db.add_source( s, self.trans)
self.generated_sources.append( s.get_handle())
@@ -1725,48 +1725,48 @@ class TestcaseGenerator(tool.BatchTool):
if issubclass(o.__class__,gen.lib.urlbase.UrlBase):
while randint(0,1) == 1:
- u = gen.lib.Url()
+ u = Url()
self.fill_object(u)
o.add_url(u)
- if isinstance(o,gen.lib.Url):
+ if isinstance(o,Url):
o.set_path("http://www.gramps-project.org/?test=%s" % self.rand_text(self.SHORT))
o.set_description( self.rand_text(self.SHORT))
- o.set_type( self.rand_type(gen.lib.UrlType()))
+ o.set_type( self.rand_type(UrlType()))
return o
def rand_personal_event( self, type=None, start=None, end=None):
if type:
- typeval = gen.lib.EventType(type)
+ typeval = EventType(type)
else:
- typeval = self.rand_type(gen.lib.EventType())
+ typeval = self.rand_type(EventType())
return self._rand_event( typeval, start, end)
def rand_family_event( self, type=None, start=None, end=None):
if type:
- typeval = gen.lib.EventType(type)
+ typeval = EventType(type)
else:
- typeval = gen.lib.EventType.UNKNOWN
+ typeval = EventType.UNKNOWN
while int(typeval) not in self.FAMILY_EVENTS:
- typeval = self.rand_type(gen.lib.EventType())
+ typeval = self.rand_type(EventType())
return self._rand_event( typeval, start, end)
def _rand_event( self, type, start, end):
- e = gen.lib.Event()
+ e = Event()
self.fill_object(e)
e.set_type( type)
(year, d) = self.rand_date( start, end)
e.set_date_object( d)
event_h = self.db.add_event(e, self.trans)
self.generated_events.append(event_h)
- event_ref = gen.lib.EventRef()
+ event_ref = EventRef()
self.fill_object(event_ref)
event_ref.set_reference_handle(event_h)
return (year, event_ref)
def rand_type( self, list):
- if issubclass( list.__class__, gen.lib.GrampsType):
+ if issubclass( list.__class__, GrampsType):
map = list.get_map()
key = choice( map.keys())
if key == list.get_custom():
@@ -1778,7 +1778,7 @@ class TestcaseGenerator(tool.BatchTool):
def rand_place( self):
if not self.generated_places or randint(0,10) == 1:
- place = gen.lib.Place()
+ place = Place()
self.fill_object( place)
self.db.add_place( place, self.trans)
self.generated_places.append( place.get_handle())
diff --git a/gramps/plugins/tool/verify.py b/gramps/plugins/tool/verify.py
index 0a7c957a7..d336398a8 100644
--- a/gramps/plugins/tool/verify.py
+++ b/gramps/plugins/tool/verify.py
@@ -56,7 +56,7 @@ from gi.repository import GObject
#
#------------------------------------------------------------------------
from gen.const import URL_MANUAL_PAGE, VERSION_DIR
-import gen.lib
+from gramps.gen.lib import ChildRefType, EventRoleType, EventType, FamilyRelType, NameType, Person
from gui.editors import EditPerson, EditFamily
from gen.utils.db import family_name
from gui.display import display_help
@@ -137,8 +137,8 @@ def get_date_from_event_type(db,person,event_type,estimate=False):
for event_ref in person.get_event_ref_list():
event = find_event(db,event_ref.ref)
if event:
- if event_ref.get_role() != gen.lib.EventRoleType.PRIMARY and \
- event.get_type() == gen.lib.EventType.BURIAL:
+ if event_ref.get_role() != EventRoleType.PRIMARY and \
+ event.get_type() == EventType.BURIAL:
continue
if event.get_type() == event_type:
date_obj = event.get_date_object()
@@ -150,16 +150,16 @@ def get_date_from_event_type(db,person,event_type,estimate=False):
def get_bapt_date(db,person,estimate=False):
return get_date_from_event_type(db, person,
- gen.lib.EventType.BAPTISM, estimate)
+ EventType.BAPTISM, estimate)
def get_bury_date(db,person,estimate=False):
# check role on burial event
for event_ref in person.get_event_ref_list():
event = find_event(db, event_ref.ref)
- if event and event.get_type() == gen.lib.EventType.BURIAL and \
- event_ref.get_role() == gen.lib.EventRoleType.PRIMARY:
+ if event and event.get_type() == EventType.BURIAL and \
+ event_ref.get_role() == EventRoleType.PRIMARY:
return get_date_from_event_type(db, person,
- gen.lib.EventType.BURIAL, estimate)
+ EventType.BURIAL, estimate)
def get_birth_date(db,person,estimate=False):
if not person:
@@ -230,9 +230,9 @@ def get_marriage_date(db,family):
return 0
for event_ref in family.get_event_ref_list():
event = find_event(db,event_ref.ref)
- if event.get_type() == gen.lib.EventType.MARRIAGE and \
- (event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
- event_ref.get_role() == gen.lib.EventRoleType.PRIMARY ):
+ if event.get_type() == EventType.MARRIAGE and \
+ (event_ref.get_role() == EventRoleType.FAMILY or
+ event_ref.get_role() == EventRoleType.PRIMARY ):
date_obj = event.get_date_object()
return date_obj.get_sort_value()
return 0
@@ -944,8 +944,8 @@ class UnknownGender(PersonRule):
ID = 8
SEVERITY = Rule.WARNING
def broken(self):
- female = self.obj.get_gender() == gen.lib.Person.FEMALE
- male = self.obj.get_gender() == gen.lib.Person.MALE
+ female = self.obj.get_gender() == Person.FEMALE
+ male = self.obj.get_gender() == Person.MALE
return not (male or female)
def get_message(self):
@@ -1011,11 +1011,11 @@ class TooManyChildren(PersonRule):
def broken(self):
n_child = get_n_children(self.db,self.obj)
- if (self.obj.get_gender == gen.lib.Person.MALE
+ if (self.obj.get_gender == Person.MALE
and n_child > self.mx_child_dad):
return True
- if (self.obj.get_gender == gen.lib.Person.FEMALE
+ if (self.obj.get_gender == Person.FEMALE
and n_child > self.mx_child_mom):
return True
@@ -1033,7 +1033,7 @@ class SameSexFamily(FamilyRule):
same_sex = (mother and father and
(mother.get_gender() == father.get_gender()))
unknown_sex = (mother and
- (mother.get_gender() == gen.lib.Person.UNKNOWN))
+ (mother.get_gender() == Person.UNKNOWN))
return (same_sex and not unknown_sex)
def get_message(self):
@@ -1044,7 +1044,7 @@ class FemaleHusband(FamilyRule):
SEVERITY = Rule.WARNING
def broken(self):
father = get_father(self.db,self.obj)
- return (father and (father.get_gender() == gen.lib.Person.FEMALE))
+ return (father and (father.get_gender() == Person.FEMALE))
def get_message(self):
return _("Female husband")
@@ -1054,7 +1054,7 @@ class MaleWife(FamilyRule):
SEVERITY = Rule.WARNING
def broken(self):
mother = get_mother(self.db,self.obj)
- return (mother and (mother.get_gender() == gen.lib.Person.MALE))
+ return (mother and (mother.get_gender() == Person.MALE))
def get_message(self):
return _("Male wife")
@@ -1072,8 +1072,8 @@ class SameSurnameFamily(FamilyRule):
mname = mother.get_primary_name()
fname = father.get_primary_name()
# Only compare birth names (not married names).
- if mname.get_type() == gen.lib.NameType.BIRTH and \
- fname.get_type() == gen.lib.NameType.BIRTH:
+ if mname.get_type() == NameType.BIRTH and \
+ fname.get_type() == NameType.BIRTH:
# Empty names don't count.
if len(mname.get_surname()) != 0 and \
len(fname.get_surname()) != 0:
@@ -1415,8 +1415,8 @@ class DeadParent(FamilyRule):
if not child_birth_date_ok:
continue
- hasBirthRelToMother = child_ref.mrel == gen.lib.ChildRefType.BIRTH
- hasBirthRelToFather = child_ref.frel == gen.lib.ChildRefType.BIRTH
+ hasBirthRelToMother = child_ref.mrel == ChildRefType.BIRTH
+ hasBirthRelToFather = child_ref.frel == ChildRefType.BIRTH
father_broken = (hasBirthRelToFather
and father_death_date_ok
@@ -1545,7 +1545,7 @@ class MarriedRelation(FamilyRule):
def broken(self):
marr_date = get_marriage_date(self.db,self.obj)
marr_date_ok = marr_date > 0
- married = self.obj.get_relationship() == gen.lib.FamilyRelType.MARRIED
+ married = self.obj.get_relationship() == FamilyRelType.MARRIED
if not married and marr_date_ok:
return self.get_message
diff --git a/gramps/plugins/view/citationlistview.py b/gramps/plugins/view/citationlistview.py
index 6553a6a52..53549f352 100644
--- a/gramps/plugins/view/citationlistview.py
+++ b/gramps/plugins/view/citationlistview.py
@@ -47,7 +47,7 @@ from gi.repository import Gtk
#-------------------------------------------------------------------------
from gui.views.treemodels.citationlistmodel import CitationListModel
from gen.plug import CATEGORY_QR_CITATION
-import gen.lib
+from gramps.gen.lib import Citation, Source
from gui.views.listview import ListView
from gen.utils.db import get_citation_referents
from gui.views.bookmarks import CitationBookmarks
@@ -265,8 +265,8 @@ class CitationListView(ListView):
window to already exist, so this is just an extra safety measure.
"""
try:
- EditCitation(self.dbstate, self.uistate, [], gen.lib.Citation(),
- gen.lib.Source())
+ EditCitation(self.dbstate, self.uistate, [], Citation(),
+ Source())
except WindowActiveError:
pass
diff --git a/gramps/plugins/view/citationtreeview.py b/gramps/plugins/view/citationtreeview.py
index 678c25e35..101d589ea 100644
--- a/gramps/plugins/view/citationtreeview.py
+++ b/gramps/plugins/view/citationtreeview.py
@@ -48,7 +48,7 @@ from gi.repository import Gtk
from gui.views.listview import LISTTREE
from gui.views.treemodels.citationtreemodel import CitationTreeModel
from gen.plug import CATEGORY_QR_SOURCE_OR_CITATION
-import gen.lib
+from gramps.gen.lib import Citation, Source
from gui.views.listview import ListView
from gen.utils.db import (get_source_and_citation_referents,
get_citation_referents)
@@ -387,7 +387,7 @@ class CitationTreeView(ListView):
window to already exist, so this is just an extra safety measure.
"""
try:
- EditSource(self.dbstate, self.uistate, [], gen.lib.Source())
+ EditSource(self.dbstate, self.uistate, [], Source())
except WindowActiveError:
pass
@@ -409,8 +409,8 @@ class CitationTreeView(ListView):
window to already exist, so this is just an extra safety measure.
"""
try:
- EditCitation(self.dbstate, self.uistate, [], gen.lib.Citation(),
- gen.lib.Source())
+ EditCitation(self.dbstate, self.uistate, [], Citation(),
+ Source())
except WindowActiveError:
pass
@@ -428,7 +428,7 @@ class CitationTreeView(ListView):
if source:
try:
EditCitation(self.dbstate, self.uistate, [],
- gen.lib.Citation(), source)
+ Citation(), source)
except WindowActiveError:
from gui.dialog import WarningDialog
WarningDialog(_("Cannot share this reference"),
diff --git a/gramps/plugins/view/eventview.py b/gramps/plugins/view/eventview.py
index bf9c7fefe..2133c8845 100644
--- a/gramps/plugins/view/eventview.py
+++ b/gramps/plugins/view/eventview.py
@@ -46,7 +46,7 @@ from gi.repository import Gtk
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Event
from gui.views.listview import ListView
from gui.views.treemodels import EventModel
from gen.errors import WindowActiveError
@@ -228,7 +228,7 @@ class EventView(ListView):
def add(self, obj):
try:
- EditEvent(self.dbstate, self.uistate, [], gen.lib.Event())
+ EditEvent(self.dbstate, self.uistate, [], Event())
except WindowActiveError:
pass
diff --git a/gramps/plugins/view/familyview.py b/gramps/plugins/view/familyview.py
index f92e6b96a..c412a1e38 100644
--- a/gramps/plugins/view/familyview.py
+++ b/gramps/plugins/view/familyview.py
@@ -45,7 +45,7 @@ from gi.repository import Gtk
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Family
from gui.views.listview import ListView
from gui.views.treemodels import FamilyModel
from gui.editors import EditFamily
@@ -242,7 +242,7 @@ class FamilyView(ListView):
"no one was selected."))
def add(self, obj):
- family = gen.lib.Family()
+ family = Family()
try:
EditFamily(self.dbstate, self.uistate, [], family)
except WindowActiveError:
diff --git a/gramps/plugins/view/geoclose.py b/gramps/plugins/view/geoclose.py
index 13f196307..ee23292ab 100644
--- a/gramps/plugins/view/geoclose.py
+++ b/gramps/plugins/view/geoclose.py
@@ -48,7 +48,7 @@ _LOG = logging.getLogger("GeoGraphy.geoclose")
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventRoleType, EventType
from gen.config import config
from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
@@ -337,7 +337,7 @@ class GeoClose(GeoGraphyView):
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(event.get_type())
+ evt = EventType(event.get_type())
descr1 = _("%(eventtype)s : %(name)s") % {
'eventtype': evt,
'name': _nd.display(person)}
@@ -389,7 +389,7 @@ class GeoClose(GeoGraphyView):
latitude, longitude = conv_lat_lon(
latitude, longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(
+ evt = EventType(
event.get_type())
eyear = str("%04d" % event.get_date_object().to_calendar(self.cal).get_year()) + \
str("%02d" % event.get_date_object().to_calendar(self.cal).get_month()) + \
@@ -445,9 +445,9 @@ class GeoClose(GeoGraphyView):
date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
- if ( plce[11] == gen.lib.EventRoleType.PRIMARY ):
+ if ( plce[11] == EventRoleType.PRIMARY ):
message = "(%s) %s : %s" % ( date, plce[2], plce[1] )
- elif ( plce[11] == gen.lib.EventRoleType.FAMILY ):
+ elif ( plce[11] == EventRoleType.FAMILY ):
(father_name, mother_name) = self._get_father_and_mother_name(evt)
message = "(%s) %s : %s - %s" % (date, plce[7],
father_name,
diff --git a/gramps/plugins/view/geoevents.py b/gramps/plugins/view/geoevents.py
index 0c6fd099d..32021dc6d 100644
--- a/gramps/plugins/view/geoevents.py
+++ b/gramps/plugins/view/geoevents.py
@@ -54,7 +54,7 @@ _LOG = logging.getLogger("GeoGraphy.geoevents")
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventType
from gen.config import config
from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
@@ -335,7 +335,7 @@ class GeoEvents(GeoGraphyView):
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
# format the date as described in preferences.
date = displayer.display(evt.get_date_object())
- message = "(%s) %s : %s" % (date, gen.lib.EventType( mark[7] ), mark[5] )
+ message = "(%s) %s : %s" % (date, EventType( mark[7] ), mark[5] )
prevmark = mark
add_item = Gtk.MenuItem(label=message)
add_item.show()
diff --git a/gramps/plugins/view/geofamclose.py b/gramps/plugins/view/geofamclose.py
index 5c7544e6d..33f93f4f7 100644
--- a/gramps/plugins/view/geofamclose.py
+++ b/gramps/plugins/view/geofamclose.py
@@ -48,7 +48,7 @@ _LOG = logging.getLogger("GeoGraphy.geofamilyclose")
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventRoleType, EventType
from gen.config import config
from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
@@ -442,7 +442,7 @@ class GeoFamClose(GeoGraphyView):
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(event.get_type())
+ evt = EventType(event.get_type())
descr1 = _("%(eventtype)s : %(name)s") % {
'eventtype': evt,
'name': _nd.display(person)}
@@ -494,7 +494,7 @@ class GeoFamClose(GeoGraphyView):
latitude, longitude = conv_lat_lon(
latitude, longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(
+ evt = EventType(
event.get_type())
eyear = str("%04d" % event.get_date_object().to_calendar(self.cal).get_year()) + \
str("%02d" % event.get_date_object().to_calendar(self.cal).get_month()) + \
@@ -634,9 +634,9 @@ class GeoFamClose(GeoGraphyView):
date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
- if ( plce[11] == gen.lib.EventRoleType.PRIMARY ):
+ if ( plce[11] == EventRoleType.PRIMARY ):
message = "(%s) %s : %s" % ( date, plce[2], plce[1] )
- elif ( plce[11] == gen.lib.EventRoleType.FAMILY ):
+ elif ( plce[11] == EventRoleType.FAMILY ):
(father_name, mother_name) = self._get_father_and_mother_name(evt)
message = "(%s) %s : %s - %s" % (date, plce[7],
father_name,
diff --git a/gramps/plugins/view/geofamily.py b/gramps/plugins/view/geofamily.py
index 7940013ab..cdaa6ca6b 100644
--- a/gramps/plugins/view/geofamily.py
+++ b/gramps/plugins/view/geofamily.py
@@ -54,7 +54,7 @@ _LOG = logging.getLogger("GeoGraphy.geofamily")
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventRoleType, EventType
from gen.config import config
from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
@@ -208,7 +208,7 @@ class GeoFamily(GeoGraphyView):
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(event.get_type())
+ evt = EventType(event.get_type())
descr1 = _("%(eventtype)s : %(name)s") % {
'eventtype': evt,
'name': _nd.display(person)}
@@ -249,7 +249,7 @@ class GeoFamily(GeoGraphyView):
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(event.get_type())
+ evt = EventType(event.get_type())
(father_name, mother_name) = self._get_father_and_mother_name(event)
descr1 = "%s : %s - " % ( evt, father_name )
descr1 = "%s%s" % ( descr1, mother_name )
@@ -428,9 +428,9 @@ class GeoFamily(GeoGraphyView):
date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
- if ( mark[5] == gen.lib.EventRoleType.PRIMARY ):
+ if ( mark[5] == EventRoleType.PRIMARY ):
message = "(%s) %s : %s" % ( date, mark[7], mark[1] )
- elif ( mark[5] == gen.lib.EventRoleType.FAMILY ):
+ elif ( mark[5] == EventRoleType.FAMILY ):
evt = self.dbstate.db.get_event_from_gramps_id(mark[10])
(father_name, mother_name) = self._get_father_and_mother_name(evt)
message = "(%s) %s : %s - %s" % ( date, mark[7], father_name, mother_name )
diff --git a/gramps/plugins/view/geomoves.py b/gramps/plugins/view/geomoves.py
index c2a462e90..81a512944 100644
--- a/gramps/plugins/view/geomoves.py
+++ b/gramps/plugins/view/geomoves.py
@@ -52,7 +52,7 @@ _LOG = logging.getLogger("GeoGraphy.geomoves")
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventRoleType, EventType
from gen.config import config
from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
@@ -292,7 +292,7 @@ class GeoMoves(GeoGraphyView):
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(event.get_type())
+ evt = EventType(event.get_type())
descr1 = _("%(eventtype)s : %(name)s") % {
'eventtype': evt,
'name': _nd.display(person)}
@@ -344,7 +344,7 @@ class GeoMoves(GeoGraphyView):
latitude, longitude = conv_lat_lon(
latitude, longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(
+ evt = EventType(
event.get_type())
eyear = str("%04d" % event.get_date_object().to_calendar(self.cal).get_year()) + \
str("%02d" % event.get_date_object().to_calendar(self.cal).get_month()) + \
@@ -504,9 +504,9 @@ class GeoMoves(GeoGraphyView):
try:
date = event.get_date_object().to_calendar(self.cal)
fyear = str("%04d" % date.get_year())
- if event.get_type() == gen.lib.EventType.BIRTH:
+ if event.get_type() == EventType.BIRTH:
birth = fyear
- if event.get_type() == gen.lib.EventType.DEATH:
+ if event.get_type() == EventType.DEATH:
death = fyear
if fyear < low_date:
low_date = fyear
@@ -573,10 +573,10 @@ class GeoMoves(GeoGraphyView):
date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
- if ( mark[11] == gen.lib.EventRoleType.PRIMARY ):
+ if ( mark[11] == EventRoleType.PRIMARY ):
person = self.dbstate.db.get_person_from_gramps_id(mark[1])
message = "(%s) %s : %s" % ( date, mark[2], _nd.display(person) )
- elif ( mark[11] == gen.lib.EventRoleType.FAMILY ):
+ elif ( mark[11] == EventRoleType.FAMILY ):
(father_name, mother_name) = self._get_father_and_mother_name(evt)
message = "(%s) %s : %s - %s" % (date, mark[2],
father_name,
diff --git a/gramps/plugins/view/geoperson.py b/gramps/plugins/view/geoperson.py
index 1f3e67a5a..1db8a472c 100644
--- a/gramps/plugins/view/geoperson.py
+++ b/gramps/plugins/view/geoperson.py
@@ -55,7 +55,7 @@ _LOG = logging.getLogger("GeoGraphy.geoperson")
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventRoleType, EventType
from gen.config import config
from gramps.gen.datehandler import displayer
from gen.display.name import displayer as _nd
@@ -324,7 +324,7 @@ class GeoPerson(GeoGraphyView):
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(event.get_type())
+ evt = EventType(event.get_type())
descr1 = _("%(eventtype)s : %(name)s") % {
'eventtype': evt,
'name': _nd.display(person)}
@@ -374,7 +374,7 @@ class GeoPerson(GeoGraphyView):
latitude, longitude = conv_lat_lon(latitude,
longitude, "D.D8")
descr = place.get_title()
- evt = gen.lib.EventType(event.get_type())
+ evt = EventType(event.get_type())
eyear = str("%04d" % event.get_date_object().to_calendar(self.cal).get_year()) + \
str("%02d" % event.get_date_object().to_calendar(self.cal).get_month()) + \
str("%02d" % event.get_date_object().to_calendar(self.cal).get_day())
@@ -453,9 +453,9 @@ class GeoPerson(GeoGraphyView):
date = displayer.display(evt.get_date_object())
if date == "":
date = _("Unknown")
- if ( mark[11] == gen.lib.EventRoleType.PRIMARY ):
+ if ( mark[11] == EventRoleType.PRIMARY ):
message = "(%s) %s : %s" % ( date, mark[2], mark[1] )
- elif ( mark[11] == gen.lib.EventRoleType.FAMILY ):
+ elif ( mark[11] == EventRoleType.FAMILY ):
(father_name, mother_name) = self._get_father_and_mother_name(evt)
message = "(%s) %s : %s - %s" % ( date, mark[7], father_name, mother_name )
else:
diff --git a/gramps/plugins/view/geoplaces.py b/gramps/plugins/view/geoplaces.py
index 9e83f12ca..795c25fbf 100644
--- a/gramps/plugins/view/geoplaces.py
+++ b/gramps/plugins/view/geoplaces.py
@@ -55,7 +55,7 @@ _LOG = logging.getLogger("GeoGraphy.geoplaces")
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import EventType
from gen.config import config
from gen.display.name import displayer as _nd
from gen.utils.place import conv_lat_lon
@@ -212,7 +212,7 @@ class GeoPlaces(GeoGraphyView):
self._append_to_places_list(descr, None, "",
latitude, longitude,
None, None,
- gen.lib.EventType.UNKNOWN,
+ EventType.UNKNOWN,
None, # person.gramps_id
place.gramps_id,
None, # event.gramps_id
diff --git a/gramps/plugins/view/mediaview.py b/gramps/plugins/view/mediaview.py
index fdc11b6f4..398d778e0 100644
--- a/gramps/plugins/view/mediaview.py
+++ b/gramps/plugins/view/mediaview.py
@@ -59,7 +59,7 @@ from gen.utils.file import (media_path, relative_path, media_path_full,
from gen.utils.db import get_media_referents
from gui.views.bookmarks import MediaBookmarks
import gen.mime
-import gen.lib
+from gramps.gen.lib import MediaObject
from gen.db import DbTxn
from gui.editors import EditMedia, DeleteMediaQuery
from gen.errors import WindowActiveError
@@ -189,7 +189,7 @@ class MediaView(ListView):
mime = gen.mime.get_type(name)
if not gen.mime.is_valid_type(mime):
return
- photo = gen.lib.MediaObject()
+ photo = MediaObject()
base_dir = unicode(media_path(self.dbstate.db))
if os.path.exists(base_dir):
name = relative_path(name, base_dir)
@@ -335,7 +335,7 @@ class MediaView(ListView):
def add(self, obj):
"""Add a new media object to the media list"""
try:
- EditMedia(self.dbstate, self.uistate, [], gen.lib.MediaObject())
+ EditMedia(self.dbstate, self.uistate, [], MediaObject())
except WindowActiveError:
pass
diff --git a/gramps/plugins/view/pedigreeview.py b/gramps/plugins/view/pedigreeview.py
index 4b3cfc547..3170ae6e6 100644
--- a/gramps/plugins/view/pedigreeview.py
+++ b/gramps/plugins/view/pedigreeview.py
@@ -53,7 +53,7 @@ import cairo
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import ChildRef, ChildRefType, Family
from gui.views.navigationview import NavigationView
from gui.editors import FilterEditor
from gen.display.name import displayer as name_displayer
@@ -1272,8 +1272,8 @@ class PedigreeView(NavigationView):
if family_handle: # one parent already exists -> Edit current family
family = self.dbstate.db.get_family_from_handle(family_handle)
else: # no parents -> create new family
- family = gen.lib.Family()
- childref = gen.lib.ChildRef()
+ family = Family()
+ childref = ChildRef()
childref.set_reference_handle(person_handle)
family.add_child_ref(childref)
try:
@@ -1505,8 +1505,8 @@ class PedigreeView(NavigationView):
if family:
for child_ref in family.get_child_ref_list():
if child_ref.ref == person.handle:
- mrel = child_ref.mrel == gen.lib.ChildRefType.BIRTH
- frel = child_ref.frel == gen.lib.ChildRefType.BIRTH
+ mrel = child_ref.mrel == ChildRefType.BIRTH
+ frel = child_ref.frel == ChildRefType.BIRTH
lst[index] = [person, val, family, alive, None]
father_handle = family.get_father_handle()
if father_handle:
diff --git a/gramps/plugins/view/persontreeview.py b/gramps/plugins/view/persontreeview.py
index 8af6152b0..e56d0196a 100644
--- a/gramps/plugins/view/persontreeview.py
+++ b/gramps/plugins/view/persontreeview.py
@@ -41,7 +41,7 @@ from gi.repository import Gtk
from gui.views.listview import LISTTREE
from gramps.plugins.lib.libpersonview import BasePersonView
from gui.views.treemodels.peoplemodel import PersonTreeModel
-import gen.lib
+from gramps.gen.lib import Name, Person, Surname
from gen.errors import WindowActiveError
from gui.editors import EditPerson
from gen.utils.db import preset_name
@@ -161,13 +161,13 @@ class PersonTreeView(BasePersonView):
'''
def add(self, obj):
- person = gen.lib.Person()
+ person = Person()
# attempt to get the current surname
(model, pathlist) = self.selection.get_selected_rows()
- name = gen.lib.Name()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
basepers = None
if len(pathlist) == 1:
diff --git a/gramps/plugins/view/placetreeview.py b/gramps/plugins/view/placetreeview.py
index 1a40bcd91..b914f1089 100644
--- a/gramps/plugins/view/placetreeview.py
+++ b/gramps/plugins/view/placetreeview.py
@@ -31,7 +31,7 @@ Place Tree View
from gui.views.listview import LISTTREE
from gramps.plugins.lib.libplaceview import PlaceBaseView
from gui.views.treemodels.placemodel import PlaceTreeModel, COUNTRYLEVELS
-import gen.lib
+from gramps.gen.lib import Place
from gen.errors import WindowActiveError
from gui.editors import EditPlace
@@ -195,7 +195,7 @@ class PlaceTreeView(PlaceBaseView):
Add a new place. Attempt to get the top three levels of hierarchy from
the currently selected row.
"""
- place = gen.lib.Place()
+ place = Place()
model, pathlist = self.selection.get_selected_rows()
level = [u"", u"", u""]
diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py
index 8e610fd9a..35e44e582 100644
--- a/gramps/plugins/view/relview.py
+++ b/gramps/plugins/view/relview.py
@@ -55,7 +55,7 @@ from gi.repository import Pango
# Gramps Modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import ChildRef, EventRoleType, EventType, Family, FamilyRelType, Name, Person, Surname
from gen.db import DbTxn
from gui.views.navigationview import NavigationView
from gui.editors import EditPerson, EditFamily
@@ -77,9 +77,9 @@ from gen.utils.db import (get_birth_or_fallback, get_death_or_fallback,
preset_name)
_GenderCode = {
- gen.lib.Person.MALE : u'\u2642',
- gen.lib.Person.FEMALE : u'\u2640',
- gen.lib.Person.UNKNOWN : u'\u2650',
+ Person.MALE : u'\u2642',
+ Person.FEMALE : u'\u2640',
+ Person.UNKNOWN : u'\u2650',
}
_NAME_START = 0
@@ -881,9 +881,9 @@ class RelationshipView(NavigationView):
elif count == 1 :
gender = self.dbstate.db.get_person_from_handle(
child_list[0]).gender
- if gender == gen.lib.Person.MALE :
+ if gender == Person.MALE :
childmsg = _(" (1 brother)")
- elif gender == gen.lib.Person.FEMALE :
+ elif gender == Person.FEMALE :
childmsg = _(" (1 sister)")
else :
childmsg = _(" (1 sibling)")
@@ -937,9 +937,9 @@ class RelationshipView(NavigationView):
elif count == 1 :
gender = self.dbstate.db.get_person_from_handle(
child_list[0]).gender
- if gender == gen.lib.Person.MALE :
+ if gender == Person.MALE :
childmsg = _(" (1 brother)")
- elif gender == gen.lib.Person.FEMALE :
+ elif gender == Person.FEMALE :
childmsg = _(" (1 sister)")
else :
childmsg = _(" (1 sibling)")
@@ -1168,7 +1168,7 @@ class RelationshipView(NavigationView):
return None
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)
@@ -1180,7 +1180,7 @@ class RelationshipView(NavigationView):
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)
@@ -1275,8 +1275,8 @@ class RelationshipView(NavigationView):
handle = event_ref.ref
event = self.dbstate.db.get_event_from_handle(handle)
if (event and event.get_type().is_relationship_event() and
- (event_ref.get_role() == gen.lib.EventRoleType.FAMILY or
- event_ref.get_role() == gen.lib.EventRoleType.PRIMARY)):
+ (event_ref.get_role() == EventRoleType.FAMILY or
+ event_ref.get_role() == EventRoleType.PRIMARY)):
self.write_event_ref(vbox, event.get_type().string, event)
value = True
return value
@@ -1361,7 +1361,7 @@ class RelationshipView(NavigationView):
# show "V Family: ..." and the rest
self.write_label("%s:" % _('Family'), family, False, person)
if (handle or
- family.get_relationship() != gen.lib.FamilyRelType.UNKNOWN):
+ family.get_relationship() != FamilyRelType.UNKNOWN):
box = self.write_person(_('Spouse'), handle)
if not self.write_relationship_events(box, family):
@@ -1459,12 +1459,12 @@ class RelationshipView(NavigationView):
def add_family(self, obj, event, handle):
if button_activated(event, _LEFT_BUTTON):
- family = gen.lib.Family()
+ family = Family()
person = self.dbstate.db.get_person_from_handle(self.get_active())
if not person:
return
- if person.gender == gen.lib.Person.MALE:
+ if person.gender == Person.MALE:
family.set_father_handle(person.handle)
else:
family.set_mother_handle(person.handle)
@@ -1475,13 +1475,13 @@ class RelationshipView(NavigationView):
pass
def add_spouse(self, obj):
- family = gen.lib.Family()
+ family = Family()
person = self.dbstate.db.get_person_from_handle(self.get_active())
if not person:
return
- if person.gender == gen.lib.Person.MALE:
+ if person.gender == Person.MALE:
family.set_father_handle(person.handle)
else:
family.set_mother_handle(person.handle)
@@ -1498,10 +1498,10 @@ class RelationshipView(NavigationView):
def add_child_to_fam(self, obj, event, handle):
if button_activated(event, _LEFT_BUTTON):
callback = lambda x: self.callback_add_child(x, handle)
- person = gen.lib.Person()
- name = gen.lib.Name()
+ person = Person()
+ name = Name()
#the editor requires a surname
- name.add_surname(gen.lib.Surname())
+ name.add_surname(Surname())
name.set_primary_surname(0)
family = self.dbstate.db.get_family_from_handle(handle)
father = self.dbstate.db.get_person_from_handle(
@@ -1516,7 +1516,7 @@ class RelationshipView(NavigationView):
pass
def callback_add_child(self, person, family_handle):
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = person.get_handle()
family = self.dbstate.db.get_family_from_handle(family_handle)
family.add_child_ref(ref)
@@ -1578,13 +1578,13 @@ class RelationshipView(NavigationView):
self.dbstate.db.add_child_to_family(family, child)
def add_parents(self, obj):
- family = gen.lib.Family()
+ family = Family()
person = self.dbstate.db.get_person_from_handle(self.get_active())
if not person:
return
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = person.handle
family.add_child_ref(ref)
@@ -1595,10 +1595,10 @@ class RelationshipView(NavigationView):
def add_parent_family(self, obj, event, handle):
if button_activated(event, _LEFT_BUTTON):
- family = gen.lib.Family()
+ family = Family()
person = self.dbstate.db.get_person_from_handle(self.get_active())
- ref = gen.lib.ChildRef()
+ ref = ChildRef()
ref.ref = person.handle
family.add_child_ref(ref)
diff --git a/gramps/plugins/view/repoview.py b/gramps/plugins/view/repoview.py
index 9a75bef3b..e4050512b 100644
--- a/gramps/plugins/view/repoview.py
+++ b/gramps/plugins/view/repoview.py
@@ -36,7 +36,7 @@ from gi.repository import Gtk
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Repository
from gui.views.listview import ListView
from gui.views.treemodels import RepositoryModel
from gui.views.bookmarks import RepoBookmarks
@@ -212,7 +212,7 @@ class RepositoryView(ListView):
'''
def add(self, obj):
- EditRepository(self.dbstate, self.uistate, [], gen.lib.Repository())
+ EditRepository(self.dbstate, self.uistate, [], Repository())
def remove(self, obj):
self.remove_selected_objects()
diff --git a/gramps/plugins/view/sourceview.py b/gramps/plugins/view/sourceview.py
index 2e3081976..7083bdd56 100644
--- a/gramps/plugins/view/sourceview.py
+++ b/gramps/plugins/view/sourceview.py
@@ -39,7 +39,7 @@ LOG = logging.getLogger(".citation")
# gramps modules
#
#-------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Source
from gen.config import config
from gui.views.listview import ListView
from gui.views.treemodels import SourceModel
@@ -198,7 +198,7 @@ class SourceView(ListView):
'''
def add(self, obj):
- EditSource(self.dbstate, self.uistate, [], gen.lib.Source())
+ EditSource(self.dbstate, self.uistate, [], Source())
def remove(self, obj):
self.remove_selected_objects()
diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py
index 07b4153e2..dfd9ba6d5 100644
--- a/gramps/plugins/webreport/narrativeweb.py
+++ b/gramps/plugins/webreport/narrativeweb.py
@@ -77,7 +77,7 @@ log = logging.getLogger(".NarrativeWeb")
# GRAMPS module
#------------------------------------------------
from gen.ggettext import sgettext as _
-import gen.lib
+from gramps.gen.lib import ChildRefType, Date, EventType, FamilyRelType, Name, NameType, Person
from gen.lib import UrlType, date, NoteType, EventRoleType
from gen.const import PROGRAM_NAME, URL_HOMEPAGE, USER_HOME, VERSION
from gen.sort import Sort
@@ -352,11 +352,11 @@ _UNKNOWN = _("Unknown")
# Events that are usually a family event
_EVENTMAP = set(
- [gen.lib.EventType.MARRIAGE, gen.lib.EventType.MARR_ALT,
- gen.lib.EventType.MARR_SETTL, gen.lib.EventType.MARR_LIC,
- gen.lib.EventType.MARR_CONTR, gen.lib.EventType.MARR_BANNS,
- gen.lib.EventType.ENGAGEMENT, gen.lib.EventType.DIVORCE,
- gen.lib.EventType.DIV_FILING
+ [EventType.MARRIAGE, EventType.MARR_ALT,
+ EventType.MARR_SETTL, EventType.MARR_LIC,
+ EventType.MARR_CONTR, EventType.MARR_BANNS,
+ EventType.ENGAGEMENT, EventType.DIVORCE,
+ EventType.DIV_FILING
]
)
@@ -470,15 +470,15 @@ def get_gendex_data(database, event_ref):
def format_date(date):
start = date.get_start_date()
- if start != gen.lib.Date.EMPTY:
+ if start != Date.EMPTY:
cal = date.get_calendar()
mod = date.get_modifier()
quality = date.get_quality()
- if mod == gen.lib.Date.MOD_SPAN:
+ if mod == Date.MOD_SPAN:
val = "FROM %s TO %s" % (
make_gedcom_date(start, cal, mod, quality),
make_gedcom_date(date.get_stop_date(), cal, mod, quality))
- elif mod == gen.lib.Date.MOD_RANGE:
+ elif mod == Date.MOD_RANGE:
val = "BET %s AND %s" % (
make_gedcom_date(start, cal, mod, quality),
make_gedcom_date(date.get_stop_date(), cal, mod, quality))
@@ -989,8 +989,8 @@ class BasePage(object):
etype = event.get_type()
# only allow Birth, Death, Census, Marriage, and Divorce events...
- if etype in [gen.lib.EventType.BIRTH, gen.lib.EventType.DEATH, gen.lib.EventType.CENSUS,
- gen.lib.EventType.MARRIAGE, gen.lib.EventType.DIVORCE]:
+ if etype in [EventType.BIRTH, EventType.DEATH, EventType.CENSUS,
+ EventType.MARRIAGE, EventType.DIVORCE]:
place_lat_long.append([latitude, longitude, placetitle, place_handle, event_date, etype])
def _get_event_place(self, person, ppl_handle_list, place_lat_long):
@@ -1416,20 +1416,20 @@ class BasePage(object):
married_name = None
names = [primary_name] + person.get_alternate_names()
for name in names:
- if int(name.get_type()) == gen.lib.NameType.MARRIED:
+ if int(name.get_type()) == NameType.MARRIED:
married_name = name
break # use first
# Now, decide which to use:
if maiden_name is not None:
if married_name is not None:
- name = gen.lib.Name(married_name)
+ name = Name(married_name)
else:
- name = gen.lib.Name(primary_name)
+ name = Name(primary_name)
surname_obj = name.get_primary_surname()
surname_obj.set_surname(maiden_name)
else:
- name = gen.lib.Name(primary_name)
+ name = Name(primary_name)
name.set_display_as(name_format)
return _nd.display_name(name)
@@ -2355,10 +2355,10 @@ class BasePage(object):
gender = self.person.get_gender()
reltype = family.get_relationship()
- if reltype == gen.lib.FamilyRelType.MARRIED:
- if gender == gen.lib.Person.FEMALE:
+ if reltype == FamilyRelType.MARRIED:
+ if gender == Person.FEMALE:
relstr = _("Husband")
- elif gender == gen.lib.Person.MALE:
+ elif gender == Person.MALE:
relstr = _("Wife")
else:
relstr = _("Partner")
@@ -3210,15 +3210,15 @@ class FamilyListPage(BasePage):
event = self.dbase_.get_event_from_handle(evt_ref.ref)
if event:
evt_type = event.get_type()
- if evt_type in [gen.lib.EventType.MARRIAGE,
- gen.lib.EventType.DIVORCE]:
+ if evt_type in [EventType.MARRIAGE,
+ EventType.DIVORCE]:
- if evt_type == gen.lib.EventType.MARRIAGE:
+ if evt_type == EventType.MARRIAGE:
tcell1 += _dd.display(event.get_date_object())
else:
tcell1 += ' '
- if evt_type == gen.lib.EventType.DIVORCE:
+ if evt_type == EventType.DIVORCE:
tcell2 += _dd.display(event.get_date_object())
else:
tcell2 += ' '
@@ -3693,10 +3693,10 @@ class EventListPage(BasePage):
# event date
tcell = Html("td", class_ = "ColumnDate", inline = True)
trow += tcell
- date = gen.lib.Date.EMPTY
+ date = Date.EMPTY
if event:
date = event.get_date_object()
- if date and date is not gen.lib.Date.EMPTY:
+ if date and date is not Date.EMPTY:
tcell += _dd.display(date)
else:
tcell += " "
@@ -3730,14 +3730,14 @@ class EventListPage(BasePage):
self.XHTMLWriter(eventslistpage, of, sio)
def _getEventDate(self, event_handle):
- event_date = gen.lib.Date.EMPTY
+ event_date = Date.EMPTY
event = self.report.database.get_event_from_handle(event_handle)
if event:
date = event.get_date_object()
if date:
# returns the date in YYYY-MM-DD format
- return gen.lib.Date(date.get_year_calendar("Gregorian"), date.get_month(), date.get_day())
+ return Date(date.get_year_calendar("Gregorian"), date.get_month(), date.get_day())
# return empty date string
return event_date
@@ -4071,7 +4071,7 @@ class MediaPage(BasePage):
# media date
date = media.get_date_object()
- if date and date is not gen.lib.Date.EMPTY:
+ if date and date is not Date.EMPTY:
trow = Html("tr") + (
Html("td", DHEAD, class_ = "ColumnAttribute", inline = True),
Html("td", _dd.display(date), class_ = "ColumnValue", inline = True)
@@ -5312,9 +5312,9 @@ class ContactPage(BasePage):
"""
class IndividualPage(BasePage):
gender_map = {
- gen.lib.Person.MALE : _('male'),
- gen.lib.Person.FEMALE : _('female'),
- gen.lib.Person.UNKNOWN : _('unknown'),
+ Person.MALE : _('male'),
+ Person.FEMALE : _('female'),
+ Person.UNKNOWN : _('unknown'),
}
def __init__(self, report, title, person, ind_list, place_list, src_list, place_lat_long, rel_class):
@@ -5743,9 +5743,9 @@ class IndividualPage(BasePage):
top = center - _HEIGHT/2
xoff = _XOFFSET+col*(_WIDTH+_HGAP)
sex = person.gender
- if sex == gen.lib.Person.MALE:
+ if sex == Person.MALE:
divclass = "male"
- elif sex == gen.lib.Person.FEMALE:
+ elif sex == Person.FEMALE:
divclass = "female"
else:
divclass = "unknown"
@@ -6115,14 +6115,14 @@ class IndividualPage(BasePage):
table += trow
# Age At Death???
- birth_date = gen.lib.Date.EMPTY
+ birth_date = Date.EMPTY
birth_ref = self.person.get_birth_ref()
if birth_ref:
birth = self.dbase_.get_event_from_handle(birth_ref.ref)
if birth:
birth_date = birth.get_date_object()
- if birth_date and birth_date is not gen.lib.Date.EMPTY:
+ if birth_date and birth_date is not Date.EMPTY:
alive = probably_alive(self.person, self.dbase_, date.Today() )
death_date = _find_death_date(self.dbase_, self.person)
@@ -6191,7 +6191,7 @@ class IndividualPage(BasePage):
else:
tcell2 += self.get_name(person)
- if rel and rel != gen.lib.ChildRefType(gen.lib.ChildRefType.BIRTH):
+ if rel and rel != ChildRefType(ChildRefType.BIRTH):
tcell2 += ''.join([' '] *3 + ['(%s)']) % str(rel)
# return table columns to its caller
@@ -7414,7 +7414,7 @@ class NavWebReport(Report):
for event_ref in evt_ref_list:
event = self.database.get_event_from_handle(event_ref.ref)
- if event.get_type() == gen.lib.EventType.RESIDENCE:
+ if event.get_type() == EventType.RESIDENCE:
res.append(event)
if add or res or url:
@@ -8439,7 +8439,7 @@ def add_birthdate(dbase, ppl_handle_list):
# get birth date: if birth_date equals nothing, then generate a fake one?
birth_ref = person.get_birth_ref()
- birth_date = gen.lib.Date.EMPTY
+ birth_date = Date.EMPTY
if birth_ref:
birth = dbase.get_event_from_handle(birth_ref.ref)
if birth:
diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py
index cabd2cc3e..d8d8fced0 100644
--- a/gramps/plugins/webreport/webcal.py
+++ b/gramps/plugins/webreport/webcal.py
@@ -49,7 +49,7 @@ log = logging.getLogger(".WebPage")
#------------------------------------------------------------------------
# GRAMPS module
#------------------------------------------------------------------------
-import gen.lib
+from gramps.gen.lib import Date, Name, NameType, Person
from gen.const import PROGRAM_NAME, URL_HOMEPAGE, USER_HOME, VERSION
from gen.constfunc import win
from gen.plug.report import Report
@@ -274,11 +274,11 @@ class WebCalReport(Report):
if month > 0:
try:
- event_date = gen.lib.Date(year, month, day)
+ event_date = Date(year, month, day)
except ValueError:
- event_date = gen.lib.Date.EMPTY
+ event_date = Date.EMPTY
else:
- event_date = gen.lib.Date.EMPTY # Incomplete date....
+ event_date = Date.EMPTY # Incomplete date....
day_list.append((text, event, event_date))
month_dict[day] = day_list
@@ -717,7 +717,7 @@ class WebCalReport(Report):
bday_anniv_list = self.calendar.get(month, {}).get(thisday.day, [])
# date is an instance because of subtracting abilities in date.py
- event_date = gen.lib.Date(thisday.year, thisday.month, thisday.day)
+ event_date = Date(thisday.year, thisday.month, thisday.day)
# get events for this day
day_list = get_day_list(event_date, holiday_list, bday_anniv_list)
@@ -1039,20 +1039,20 @@ class WebCalReport(Report):
married_name = None
names = [primary_name] + person.get_alternate_names()
for name in names:
- if int(name.get_type()) == gen.lib.NameType.MARRIED:
+ if int(name.get_type()) == NameType.MARRIED:
married_name = name
break
# Now, decide which to use:
if maiden_name is not None:
if married_name is not None:
- name = gen.lib.Name(married_name)
+ name = Name(married_name)
else:
- name = gen.lib.Name(primary_name)
+ name = Name(primary_name)
surname_obj = name.get_primary_surname()
surname_obj.set_surname(maiden_name)
else:
- name = gen.lib.Name(primary_name)
+ name = Name(primary_name)
name.set_display_as(self.name_format)
return _nd.display_name(name)
@@ -1077,13 +1077,13 @@ class WebCalReport(Report):
family_list = person.get_family_handle_list()
birth_ref = person.get_birth_ref()
- birth_date = gen.lib.Date.EMPTY
+ birth_date = Date.EMPTY
if birth_ref:
birth_event = db.get_event_from_handle(birth_ref.ref)
birth_date = birth_event.get_date_object()
# determine birthday information???
- if (self.birthday and birth_date is not gen.lib.Date.EMPTY and birth_date.is_valid()):
+ if (self.birthday and birth_date is not Date.EMPTY and birth_date.is_valid()):
year = birth_date.get_year() or this_year
month = birth_date.get_month()
@@ -1091,11 +1091,11 @@ class WebCalReport(Report):
# date to figure if someone is still alive
# current year of calendar, month nd day is their birth month and birth day
- prob_alive_date = gen.lib.Date(this_year, month, day)
+ prob_alive_date = Date(this_year, month, day)
# add some things to handle maiden name:
father_surname = None # husband, actually
- if person.gender == gen.lib.Person.FEMALE:
+ if person.gender == Person.FEMALE:
# get husband's last name:
if self.maiden_name in ['spouse_first', 'spouse_last']:
@@ -1146,13 +1146,13 @@ class WebCalReport(Report):
marriage_event = get_marriage_event(db, fam)
if marriage_event:
event_date = marriage_event.get_date_object()
- if event_date is not gen.lib.Date.EMPTY and event_date.is_valid():
+ if event_date is not Date.EMPTY and event_date.is_valid():
year = event_date.get_year()
month = event_date.get_month()
day = event_date.get_day()
# date to figure if someone is still alive
- prob_alive_date = gen.lib.Date(this_year, month, day)
+ prob_alive_date = Date(this_year, month, day)
if self.link_to_narweb:
spouse_name = str(Html("a", spouse_name,
@@ -1652,7 +1652,7 @@ def get_day_list(event_date, holiday_list, bday_anniv_list):
# birthday/ anniversary on this day
# Date.EMPTY signifies an incomplete date for an event. See add_day_item()
bday_anniv_list = [(t, e, d) for t, e, d in bday_anniv_list
- if d != gen.lib.Date.EMPTY]
+ if d != Date.EMPTY]
# number of years have to be at least zero
bday_anniv_list = [(t, e, d) for t, e, d in bday_anniv_list
diff --git a/gramps/webapp/shell.py b/gramps/webapp/shell.py
index 588974ac7..69d07d8bf 100644
--- a/gramps/webapp/shell.py
+++ b/gramps/webapp/shell.py
@@ -19,7 +19,7 @@ from webapp.reports import import_file
from webapp.libdjango import DjangoInterface, totime, todate
from gen.datehandler import displayer, parser
from webapp.utils import StyledNoteFormatter, parse_styled_text
-import gen.lib
+from gramps.gen.lib import StyledText
import cli.user
db = DbDjango()
@@ -43,4 +43,4 @@ dp = parser.parse
#print html_text
#print parse_styled_text(html_text)
-##st = gen.lib.StyledText(note.text, dji.get_note_markup(note))
+##st = StyledText(note.text, dji.get_note_markup(note))
diff --git a/gramps/webapp/utils.py b/gramps/webapp/utils.py
index a9260a9ce..9cc163666 100644
--- a/gramps/webapp/utils.py
+++ b/gramps/webapp/utils.py
@@ -61,7 +61,7 @@ from gen.utils.alive import probably_alive as alive
from gen.dbstate import DbState
from gen.datehandler import displayer, parser
from gen.lib.date import Date as GDate, Today
-import gen.lib
+from gramps.gen.lib import Person
from gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gen.plug import BasePluginManager
from cli.grampscli import CLIManager
@@ -1261,7 +1261,7 @@ def render_name(name, user, act=None):
surname = "[No primary surname]"
return "%s, %s" % (surname,
name.model.first_name)
- elif isinstance(name, gen.lib.Person): # name is a gen.lib.Person
+ elif isinstance(name, Person): # name is a Person
person = name
try:
name = person.get_primary_name()