Changes to imports - part 3

svn: r20487
This commit is contained in:
Nick Hall 2012-10-02 19:47:38 +00:00
parent 6b5318fa18
commit a5c41d0566
112 changed files with 2069 additions and 2069 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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 '<i>%s</i>' % 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 '<i>%s</i>' % cgi.escape(get_date(death))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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*\<person\s(.*)$")
CHILD_REL_MAP = {
"Birth" : gen.lib.ChildRefType(gen.lib.ChildRefType.BIRTH),
"Adopted" : gen.lib.ChildRefType(gen.lib.ChildRefType.ADOPTED),
"Stepchild" : gen.lib.ChildRefType(gen.lib.ChildRefType.STEPCHILD),
"Sponsored" : gen.lib.ChildRefType(gen.lib.ChildRefType.SPONSORED),
"Foster" : gen.lib.ChildRefType(gen.lib.ChildRefType.FOSTER),
"Unknown" : gen.lib.ChildRefType(gen.lib.ChildRefType.UNKNOWN),
"Birth" : ChildRefType(ChildRefType.BIRTH),
"Adopted" : ChildRefType(ChildRefType.ADOPTED),
"Stepchild" : ChildRefType(ChildRefType.STEPCHILD),
"Sponsored" : ChildRefType(ChildRefType.SPONSORED),
"Foster" : ChildRefType(ChildRefType.FOSTER),
"Unknown" : ChildRefType(ChildRefType.UNKNOWN),
}
# feature requests 2356, 1658: avoid genitive form
@ -534,7 +534,7 @@ class GrampsParser(UpdateCallback):
self.surname = None
self.surnamepat = None
self.home = None
self.owner = gen.lib.Researcher()
self.owner = Researcher()
self.func_list = [None]*50
self.func_index = 0
self.func = None
@ -1013,7 +1013,7 @@ class GrampsParser(UpdateCallback):
self.user.warn(_('Old xml file'), msg)
def start_lds_ord(self, attrs):
self.ord = gen.lib.LdsOrd()
self.ord = LdsOrd()
self.ord.set_type_from_xml(attrs['type'])
self.ord.private = bool(attrs.get("priv"))
if self.person:
@ -1043,20 +1043,20 @@ class GrampsParser(UpdateCallback):
Add a family reference to the LDS ordinance currently processed.
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "family", gen.lib.Family)
handle = self.inaugurate(attrs['hlink'], "family", Family)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), FAMILY_KEY,
gen.lib.Family)
Family)
self.ord.set_family_handle(handle)
def start_place(self, attrs):
"""A reference to a place in an object: event or lds_ord
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "place", gen.lib.Place)
handle = self.inaugurate(attrs['hlink'], "place", Place)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), PLACE_KEY,
gen.lib.Place)
Place)
if self.ord:
self.ord.set_place_handle(handle)
elif self.event:
@ -1067,7 +1067,7 @@ class GrampsParser(UpdateCallback):
Add a place object to db if it doesn't exist yet and assign
id, privacy and changetime.
"""
self.placeobj = gen.lib.Place()
self.placeobj = Place()
if 'handle' in attrs:
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
@ -1097,7 +1097,7 @@ class GrampsParser(UpdateCallback):
"""Bypass the function calls for this one, since it appears to
take up quite a bit of time"""
loc = gen.lib.Location()
loc = Location()
loc.street = attrs.get('street', '')
loc.locality = attrs.get('locality', '')
loc.city = attrs.get('city', '')
@ -1123,10 +1123,10 @@ class GrampsParser(UpdateCallback):
self.in_witness = True
self.witness_comment = ""
if 'name' in attrs:
note = gen.lib.Note()
note = Note()
note.handle = create_id()
note.set(_("Witness name: %s") % attrs['name'])
note.type.set(gen.lib.NoteType.EVENT)
note.type.set(NoteType.EVENT)
note.private = self.event.private
self.db.add_note(note, self.trans)
#set correct change time
@ -1135,7 +1135,7 @@ class GrampsParser(UpdateCallback):
self.event.add_note(note.handle)
return
person = gen.lib.Person()
person = Person()
if 'hlink' in attrs:
self.inaugurate(attrs['hlink'], "person", person)
elif 'ref' in attrs:
@ -1146,9 +1146,9 @@ class GrampsParser(UpdateCallback):
# Add an EventRef from that person
# to this event using ROLE_WITNESS role
if person:
event_ref = gen.lib.EventRef()
event_ref = EventRef()
event_ref.ref = self.event.handle
event_ref.role.set(gen.lib.EventRoleType.WITNESS)
event_ref.role.set(EventRoleType.WITNESS)
person.event_ref_list.append(event_ref)
self.db.commit_person(person, self.trans, self.change)
@ -1164,9 +1164,9 @@ class GrampsParser(UpdateCallback):
if self.person or self.family:
# GRAMPS LEGACY: old events that were written inside
# person or family objects.
self.event = gen.lib.Event()
self.event = Event()
self.event.handle = create_id()
self.event.type = gen.lib.EventType()
self.event.type = EventType()
self.event.type.set_from_xml_str(attrs['type'])
self.db.add_event(self.event, self.trans)
#set correct change time
@ -1175,7 +1175,7 @@ class GrampsParser(UpdateCallback):
else:
# This is new event, with ID and handle already existing
self.update(self.p.CurrentLineNumber)
self.event = gen.lib.Event()
self.event = Event()
if 'handle' in attrs:
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
@ -1200,9 +1200,9 @@ class GrampsParser(UpdateCallback):
"""
Add an event reference to the object currently processed.
"""
self.eventref = gen.lib.EventRef()
self.eventref = EventRef()
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "event", gen.lib.Event)
handle = self.inaugurate(attrs['hlink'], "event", Event)
else: # there is no old style XML
raise GrampsImportError(_("The Gramps Xml you are trying to "
"import is malformed."), _("Any event reference must have a "
@ -1223,21 +1223,21 @@ class GrampsParser(UpdateCallback):
self.family.add_event_ref(self.eventref)
elif self.person:
event.personal = True
if (event.type == gen.lib.EventType.BIRTH) \
and (self.eventref.role == gen.lib.EventRoleType.PRIMARY) \
if (event.type == EventType.BIRTH) \
and (self.eventref.role == EventRoleType.PRIMARY) \
and (self.person.get_birth_ref() is None):
self.person.set_birth_ref(self.eventref)
elif (event.type == gen.lib.EventType.DEATH) \
and (self.eventref.role == gen.lib.EventRoleType.PRIMARY) \
elif (event.type == EventType.DEATH) \
and (self.eventref.role == EventRoleType.PRIMARY) \
and (self.person.get_death_ref() is None):
self.person.set_death_ref(self.eventref)
else:
self.person.add_event_ref(self.eventref)
def start_attribute(self, attrs):
self.attribute = gen.lib.Attribute()
self.attribute = Attribute()
self.attribute.private = bool(attrs.get("priv"))
self.attribute.type = gen.lib.AttributeType()
self.attribute.type = AttributeType()
if 'type' in attrs:
self.attribute.type.set_from_xml_str(attrs["type"])
self.attribute.value = attrs.get("value", '')
@ -1257,7 +1257,7 @@ class GrampsParser(UpdateCallback):
self.family.add_attribute(self.attribute)
def start_address(self, attrs):
self.address = gen.lib.Address()
self.address = Address()
self.address.private = bool(attrs.get("priv"))
def start_bmark(self, attrs):
@ -1270,10 +1270,10 @@ class GrampsParser(UpdateCallback):
# and this is guaranteed to be a person bookmark
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "person",
gen.lib.Person)
Person)
else:
handle = self.inaugurate_id(attrs.get('ref'), PERSON_KEY,
gen.lib.Person)
Person)
self.db.bookmarks.append(handle)
return
@ -1351,7 +1351,7 @@ class GrampsParser(UpdateCallback):
id, privacy and changetime.
"""
self.update(self.p.CurrentLineNumber)
self.person = gen.lib.Person()
self.person = Person()
if 'handle' in attrs:
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
@ -1378,7 +1378,7 @@ class GrampsParser(UpdateCallback):
Store the home person of the database.
"""
if 'home' in attrs:
handle = self.inaugurate(attrs['home'], "person", gen.lib.Person)
handle = self.inaugurate(attrs['home'], "person", Person)
self.home = handle
def start_father(self, attrs):
@ -1386,10 +1386,10 @@ class GrampsParser(UpdateCallback):
Add a father reference to the family currently processed.
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "person", gen.lib.Person)
handle = self.inaugurate(attrs['hlink'], "person", Person)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), PERSON_KEY,
gen.lib.Person)
Person)
self.family.set_father_handle(handle)
def start_mother(self, attrs):
@ -1397,10 +1397,10 @@ class GrampsParser(UpdateCallback):
Add a mother reference to the family currently processed.
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "person", gen.lib.Person)
handle = self.inaugurate(attrs['hlink'], "person", Person)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), PERSON_KEY,
gen.lib.Person)
Person)
self.family.set_mother_handle(handle)
def start_child(self, attrs):
@ -1411,10 +1411,10 @@ class GrampsParser(UpdateCallback):
frel and mrel belonged to the "childof" tag
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "person", gen.lib.Person)
handle = self.inaugurate(attrs['hlink'], "person", Person)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), PERSON_KEY,
gen.lib.Person)
Person)
# If that were the case then childref_map has the childref ready
if (self.family.handle, handle) in self.childref_map:
@ -1428,15 +1428,15 @@ class GrampsParser(UpdateCallback):
Here we are handling the new XML, in which frel and mrel
belong to the "childref" tag under family.
"""
self.childref = gen.lib.ChildRef()
handle = self.inaugurate(attrs['hlink'], "person", gen.lib.Person)
self.childref = ChildRef()
handle = self.inaugurate(attrs['hlink'], "person", Person)
self.childref.ref = handle
self.childref.private = bool(attrs.get('priv'))
mrel = gen.lib.ChildRefType()
mrel = ChildRefType()
if attrs.get('mrel'):
mrel.set_from_xml_str(attrs['mrel'])
frel = gen.lib.ChildRefType()
frel = ChildRefType()
if attrs.get('frel'):
frel.set_from_xml_str(attrs['frel'])
@ -1450,9 +1450,9 @@ class GrampsParser(UpdateCallback):
"""
Add a person reference to the person currently processed.
"""
self.personref = gen.lib.PersonRef()
self.personref = PersonRef()
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "person", gen.lib.Person)
handle = self.inaugurate(attrs['hlink'], "person", Person)
else: # there is no old style XML
raise GrampsImportError(_("The Gramps Xml you are trying to "
"import is malformed."), _("Any person reference must have a "
@ -1465,7 +1465,7 @@ class GrampsParser(UpdateCallback):
def start_url(self, attrs):
if "href" not in attrs:
return
url = gen.lib.Url()
url = Url()
url.path = attrs["href"]
url.set_description(attrs.get("description", ''))
url.private = bool(attrs.get('priv'))
@ -1483,7 +1483,7 @@ class GrampsParser(UpdateCallback):
id, privacy and changetime.
"""
self.update(self.p.CurrentLineNumber)
self.family = gen.lib.Family()
self.family = Family()
if 'handle' in attrs:
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
@ -1533,21 +1533,21 @@ class GrampsParser(UpdateCallback):
person is a child.
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "family", gen.lib.Family)
handle = self.inaugurate(attrs['hlink'], "family", Family)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), FAMILY_KEY,
gen.lib.Family)
Family)
# Here we are handling the old XML, in which
# frel and mrel belonged to the "childof" tag
mrel = gen.lib.ChildRefType()
frel = gen.lib.ChildRefType()
mrel = ChildRefType()
frel = ChildRefType()
if 'mrel' in attrs:
mrel.set_from_xml_str(attrs['mrel'])
if 'frel' in attrs:
frel.set_from_xml_str(attrs['frel'])
childref = gen.lib.ChildRef()
childref = ChildRef()
childref.ref = self.person.handle
if not mrel.is_default():
childref.set_mother_relation(mrel)
@ -1562,19 +1562,19 @@ class GrampsParser(UpdateCallback):
person is a parent.
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "family", gen.lib.Family)
handle = self.inaugurate(attrs['hlink'], "family", Family)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), FAMILY_KEY,
gen.lib.Family)
Family)
self.person.add_family_handle(handle)
def start_name(self, attrs):
if not self.in_witness:
self.name = gen.lib.Name()
self.name = Name()
name_type = attrs.get('type', "Birth Name")
# Mapping "Other Name" from gramps 2.0.x to Unknown
if (self.__xml_version == '1.0.0') and (name_type == 'Other Name'):
self.name.set_type(gen.lib.NameType.UNKNOWN)
self.name.set_type(NameType.UNKNOWN)
else:
self.name.type.set_from_xml_str(name_type)
self.name.private = bool(attrs.get("priv", 0))
@ -1601,7 +1601,7 @@ class GrampsParser(UpdateCallback):
pass
def start_surname(self, attrs):
self.surname = gen.lib.Surname()
self.surname = Surname()
self.surname.set_prefix(attrs.get("prefix", ""))
self.surname.set_primary(attrs.get("prim", "1") == "1")
self.surname.set_connector(attrs.get("connector", ""))
@ -1625,21 +1625,21 @@ class GrampsParser(UpdateCallback):
def start_last(self, attrs):
""" This is the element in version < 1.4.0 to do the surname"""
self.surname = gen.lib.Surname()
self.surname = Surname()
self.surname.prefix = attrs.get('prefix', '')
self.name.group_as = attrs.get('group', '')
def start_patronymic(self, attrs):
""" This is the element in version < 1.4.0 to do the patronymic"""
self.surnamepat = gen.lib.Surname()
self.surnamepat.set_origintype(gen.lib.NameOriginType(
gen.lib.NameOriginType.PATRONYMIC))
self.surnamepat = Surname()
self.surnamepat.set_origintype(NameOriginType(
NameOriginType.PATRONYMIC))
def start_style(self, attrs):
"""
Styled text tag in notes (v1.4.0 onwards).
"""
tagtype = gen.lib.StyledTextTagType()
tagtype = StyledTextTagType()
tagtype.set_from_xml_str(attrs['name'].lower())
try:
val = attrs['value']
@ -1656,13 +1656,13 @@ class GrampsParser(UpdateCallback):
match.group('object_class'),
self.import_handles[match.group('handle')]
[target][HANDLE])
tagvalue = gen.lib.StyledTextTagType.STYLE_TYPE[int(tagtype)](val)
tagvalue = StyledTextTagType.STYLE_TYPE[int(tagtype)](val)
except KeyError:
tagvalue = None
except ValueError:
return
self.note_tags.append(gen.lib.StyledTextTag(tagtype, tagvalue))
self.note_tags.append(StyledTextTag(tagtype, tagvalue))
def start_tag(self, attrs):
"""
@ -1674,7 +1674,7 @@ class GrampsParser(UpdateCallback):
return
# Tag defintion
self.tag = gen.lib.Tag()
self.tag = Tag()
self.inaugurate(attrs['handle'], "tag", self.tag)
self.tag.change = int(attrs.get('change', self.change))
self.info.add('new-object', TAG_KEY, self.tag)
@ -1694,7 +1694,7 @@ class GrampsParser(UpdateCallback):
"""
Tag reference in a primary object.
"""
handle = self.inaugurate(attrs['hlink'], "tag", gen.lib.Tag)
handle = self.inaugurate(attrs['hlink'], "tag", Tag)
if self.person:
self.person.add_tag(handle)
@ -1721,7 +1721,7 @@ class GrampsParser(UpdateCallback):
if 'handle' in attrs:
# This is new note, with ID and handle already existing
self.update(self.p.CurrentLineNumber)
self.note = gen.lib.Note()
self.note = Note()
if 'handle' in attrs:
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
@ -1740,9 +1740,9 @@ class GrampsParser(UpdateCallback):
self.note.private = bool(attrs.get("priv"))
self.note.change = int(attrs.get('change', self.change))
self.info.add('new-object', NOTE_KEY, self.note)
self.note.format = int(attrs.get('format', gen.lib.Note.FLOWED))
self.note.format = int(attrs.get('format', Note.FLOWED))
self.note.type.set_from_xml_str(attrs.get('type',
gen.lib.NoteType.UNKNOWN))
NoteType.UNKNOWN))
self.convert_marker(attrs, self.note)
# Since StyledText was introduced (XML v1.3.0) the clear text
@ -1756,64 +1756,64 @@ class GrampsParser(UpdateCallback):
# We need to create a top-level note, it's type depends on
# the caller object, and inherits privacy from caller object
# On stop_note the reference to this note will be added
self.note = gen.lib.Note()
self.note = Note()
self.note.handle = create_id()
self.note.format = int(attrs.get('format', gen.lib.Note.FLOWED))
self.note.format = int(attrs.get('format', Note.FLOWED))
# The order in this long if-then statement should reflect the
# DTD: most deeply nested elements come first.
if self.citation:
self.note.type.set(gen.lib.NoteType.CITATION)
self.note.type.set(NoteType.CITATION)
self.note.private = self.citation.private
elif self.address:
self.note.type.set(gen.lib.NoteType.ADDRESS)
self.note.type.set(NoteType.ADDRESS)
self.note.private = self.address.private
elif self.ord:
self.note.type.set(gen.lib.NoteType.LDS)
self.note.type.set(NoteType.LDS)
self.note.private = self.ord.private
elif self.attribute:
self.note.type.set(gen.lib.NoteType.ATTRIBUTE)
self.note.type.set(NoteType.ATTRIBUTE)
self.note.private = self.attribute.private
elif self.object:
self.note.type.set(gen.lib.NoteType.MEDIA)
self.note.type.set(NoteType.MEDIA)
self.note.private = self.object.private
elif self.objref:
self.note.type.set(gen.lib.NoteType.MEDIAREF)
self.note.type.set(NoteType.MEDIAREF)
self.note.private = self.objref.private
elif self.photo:
self.note.type.set(gen.lib.NoteType.MEDIA)
self.note.type.set(NoteType.MEDIA)
self.note.private = self.photo.private
elif self.name:
self.note.type.set(gen.lib.NoteType.PERSONNAME)
self.note.type.set(NoteType.PERSONNAME)
self.note.private = self.name.private
elif self.eventref:
self.note.type.set(gen.lib.NoteType.EVENTREF)
self.note.type.set(NoteType.EVENTREF)
self.note.private = self.eventref.private
elif self.reporef:
self.note.type.set(gen.lib.NoteType.REPOREF)
self.note.type.set(NoteType.REPOREF)
self.note.private = self.reporef.private
elif self.source:
self.note.type.set(gen.lib.NoteType.SOURCE)
self.note.type.set(NoteType.SOURCE)
self.note.private = self.source.private
elif self.event:
self.note.type.set(gen.lib.NoteType.EVENT)
self.note.type.set(NoteType.EVENT)
self.note.private = self.event.private
elif self.personref:
self.note.type.set(gen.lib.NoteType.ASSOCIATION)
self.note.type.set(NoteType.ASSOCIATION)
self.note.private = self.personref.private
elif self.person:
self.note.type.set(gen.lib.NoteType.PERSON)
self.note.type.set(NoteType.PERSON)
self.note.private = self.person.private
elif self.childref:
self.note.type.set(gen.lib.NoteType.CHILDREF)
self.note.type.set(NoteType.CHILDREF)
self.note.private = self.childref.private
elif self.family:
self.note.type.set(gen.lib.NoteType.FAMILY)
self.note.type.set(NoteType.FAMILY)
self.note.private = self.family.private
elif self.placeobj:
self.note.type.set(gen.lib.NoteType.PLACE)
self.note.type.set(NoteType.PLACE)
self.note.private = self.placeobj.private
elif self.repo:
self.note.type.set(gen.lib.NoteType.REPO)
self.note.type.set(NoteType.REPO)
self.note.private = self.repo.private
self.db.add_note(self.note, self.trans)
@ -1827,7 +1827,7 @@ class GrampsParser(UpdateCallback):
Add a note reference to the object currently processed.
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "note", gen.lib.Note)
handle = self.inaugurate(attrs['hlink'], "note", Note)
else:
raise GrampsImportError(_("The Gramps Xml you are trying to "
"import is malformed."), _("Any note reference must have a "
@ -1907,7 +1907,7 @@ class GrampsParser(UpdateCallback):
"""
Add a citation reference to the object currently processed.
"""
handle = self.inaugurate(attrs['hlink'], "citation", gen.lib.Citation)
handle = self.inaugurate(attrs['hlink'], "citation", Citation)
self.__add_citation(handle)
@ -1917,7 +1917,7 @@ class GrampsParser(UpdateCallback):
id, privacy and changetime.
"""
self.update(self.p.CurrentLineNumber)
self.citation = gen.lib.Citation()
self.citation = Citation()
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
self.db.has_citation_handle(orig_handle))
@ -1941,10 +1941,10 @@ class GrampsParser(UpdateCallback):
Add a source reference to the object currently processed.
"""
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "source", gen.lib.Source)
handle = self.inaugurate(attrs['hlink'], "source", Source)
else:
handle = self.inaugurate_id(attrs.get('ref'), SOURCE_KEY,
gen.lib.Source)
Source)
if self.citation:
self.citation.set_reference_handle(handle)
@ -1954,7 +1954,7 @@ class GrampsParser(UpdateCallback):
# Citation object.
self.in_old_sourceref = True
self.citation = gen.lib.Citation()
self.citation = Citation()
self.citation.set_reference_handle(handle)
self.citation.confidence = int(attrs.get("conf", self.conf))
self.citation.private = bool(attrs.get("priv"))
@ -1968,7 +1968,7 @@ class GrampsParser(UpdateCallback):
id, privacy and changetime.
"""
self.update(self.p.CurrentLineNumber)
self.source = gen.lib.Source()
self.source = Source()
if 'handle' in attrs:
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
@ -1993,13 +1993,13 @@ class GrampsParser(UpdateCallback):
"""
Add a repository reference to the source currently processed.
"""
self.reporef = gen.lib.RepoRef()
self.reporef = RepoRef()
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "repository",
gen.lib.Repository)
Repository)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), REPOSITORY_KEY,
gen.lib.Repository)
Repository)
self.reporef.ref = handle
self.reporef.call_number = attrs.get('callno', '')
if 'medium' in attrs:
@ -2013,13 +2013,13 @@ class GrampsParser(UpdateCallback):
"""
Add a media object reference to the object currently processed.
"""
self.objref = gen.lib.MediaRef()
self.objref = MediaRef()
if 'hlink' in attrs:
handle = self.inaugurate(attrs['hlink'], "media",
gen.lib.MediaObject)
MediaObject)
else: # old style XML
handle = self.inaugurate_id(attrs.get('ref'), MEDIA_KEY,
gen.lib.MediaObject)
MediaObject)
self.objref.ref = handle
self.objref.private = bool(attrs.get('priv'))
if self.event:
@ -2047,7 +2047,7 @@ class GrampsParser(UpdateCallback):
Add a media object to db if it doesn't exist yet and assign
id, privacy and changetime.
"""
self.object = gen.lib.MediaObject()
self.object = MediaObject()
if 'handle' in attrs:
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
@ -2082,7 +2082,7 @@ class GrampsParser(UpdateCallback):
Add a repository to db if it doesn't exist yet and assign
id, privacy and changetime.
"""
self.repo = gen.lib.Repository()
self.repo = Repository()
if 'handle' in attrs:
orig_handle = attrs['handle'].replace('_', '')
is_merge_candidate = (self.replace_import_handle and
@ -2126,8 +2126,8 @@ class GrampsParser(UpdateCallback):
self.reporef = None
def start_photo(self, attrs):
self.photo = gen.lib.MediaObject()
self.pref = gen.lib.MediaRef()
self.photo = MediaObject()
self.pref = MediaRef()
self.pref.set_reference_handle(self.photo.get_handle())
for key in attrs.keys():
@ -2140,7 +2140,7 @@ class GrampsParser(UpdateCallback):
src = attrs["src"]
self.photo.set_path(src)
else:
attr = gen.lib.Attribute()
attr = Attribute()
attr.set_type(key)
attr.set_value(attrs[key])
self.photo.add_attribute(attr)
@ -2159,10 +2159,10 @@ class GrampsParser(UpdateCallback):
self.placeobj.add_media_reference(self.pref)
def start_daterange(self, attrs):
self.start_compound_date(attrs, gen.lib.Date.MOD_RANGE)
self.start_compound_date(attrs, Date.MOD_RANGE)
def start_datespan(self, attrs):
self.start_compound_date(attrs, gen.lib.Date.MOD_SPAN)
self.start_compound_date(attrs, Date.MOD_SPAN)
def start_compound_date(self, attrs, mode):
if self.citation:
@ -2212,20 +2212,20 @@ class GrampsParser(UpdateCallback):
rng_day = 0
if "cformat" in attrs:
cal = gen.lib.Date.calendar_names.index(attrs['cformat'])
cal = Date.calendar_names.index(attrs['cformat'])
else:
cal = gen.lib.Date.CAL_GREGORIAN
cal = Date.CAL_GREGORIAN
if 'quality' in attrs:
val = attrs['quality']
if val == 'estimated':
qual = gen.lib.Date.QUAL_ESTIMATED
qual = Date.QUAL_ESTIMATED
elif val == 'calculated':
qual = gen.lib.Date.QUAL_CALCULATED
qual = Date.QUAL_CALCULATED
else:
qual = gen.lib.Date.QUAL_NONE
qual = Date.QUAL_NONE
else:
qual = gen.lib.Date.QUAL_NONE
qual = Date.QUAL_NONE
dualdated = False
if 'dualdated' in attrs:
@ -2233,13 +2233,13 @@ class GrampsParser(UpdateCallback):
if val == "1":
dualdated = True
newyear = gen.lib.Date.NEWYEAR_JAN1
newyear = Date.NEWYEAR_JAN1
if 'newyear' in attrs:
newyear = attrs['newyear']
if newyear.isdigit():
newyear = int(newyear)
else:
newyear = gen.lib.Date.newyear_to_code(newyear)
newyear = Date.newyear_to_code(newyear)
date_value.set(qual, mode, cal,
(day, month, year, dualdated,
@ -2282,31 +2282,31 @@ class GrampsParser(UpdateCallback):
day = 0
if "cformat" in attrs:
cal = gen.lib.Date.calendar_names.index(attrs['cformat'])
cal = Date.calendar_names.index(attrs['cformat'])
else:
cal = gen.lib.Date.CAL_GREGORIAN
cal = Date.CAL_GREGORIAN
if 'type' in attrs:
val = attrs['type']
if val == "about":
mod = gen.lib.Date.MOD_ABOUT
mod = Date.MOD_ABOUT
elif val == "after":
mod = gen.lib.Date.MOD_AFTER
mod = Date.MOD_AFTER
else:
mod = gen.lib.Date.MOD_BEFORE
mod = Date.MOD_BEFORE
else:
mod = gen.lib.Date.MOD_NONE
mod = Date.MOD_NONE
if 'quality' in attrs:
val = attrs['quality']
if val == 'estimated':
qual = gen.lib.Date.QUAL_ESTIMATED
qual = Date.QUAL_ESTIMATED
elif val == 'calculated':
qual = gen.lib.Date.QUAL_CALCULATED
qual = Date.QUAL_CALCULATED
else:
qual = gen.lib.Date.QUAL_NONE
qual = Date.QUAL_NONE
else:
qual = gen.lib.Date.QUAL_NONE
qual = Date.QUAL_NONE
dualdated = False
if 'dualdated' in attrs:
@ -2314,13 +2314,13 @@ class GrampsParser(UpdateCallback):
if val == "1":
dualdated = True
newyear = gen.lib.Date.NEWYEAR_JAN1
newyear = Date.NEWYEAR_JAN1
if 'newyear' in attrs:
newyear = attrs['newyear']
if newyear.isdigit():
newyear = int(newyear)
else:
newyear = gen.lib.Date.newyear_to_code(newyear)
newyear = Date.newyear_to_code(newyear)
date_value.set(qual, mod, cal, (day, month, year, dualdated),
newyear=newyear)
@ -2364,10 +2364,10 @@ class GrampsParser(UpdateCallback):
text = None
if text is not None:
note = gen.lib.Note()
note = Note()
note.handle = create_id()
note.set(_("Witness comment: %s") % text)
note.type.set(gen.lib.NoteType.EVENT)
note.type.set(NoteType.EVENT)
note.private = self.event.private
self.db.add_note(note, self.trans)
#set correct change time
@ -2431,27 +2431,27 @@ class GrampsParser(UpdateCallback):
def stop_event(self, *tag):
if self.family:
ref = gen.lib.EventRef()
ref = EventRef()
ref.ref = self.event.handle
ref.private = self.event.private
ref.role.set(gen.lib.EventRoleType.FAMILY)
ref.role.set(EventRoleType.FAMILY)
self.family.add_event_ref(ref)
elif self.person:
ref = gen.lib.EventRef()
ref = EventRef()
ref.ref = self.event.handle
ref.private = self.event.private
ref.role.set(gen.lib.EventRoleType.PRIMARY)
if (self.event.type == gen.lib.EventType.BIRTH) \
ref.role.set(EventRoleType.PRIMARY)
if (self.event.type == EventType.BIRTH) \
and (self.person.get_birth_ref() is None):
self.person.set_birth_ref(ref)
elif (self.event.type == gen.lib.EventType.DEATH) \
elif (self.event.type == EventType.DEATH) \
and (self.person.get_death_ref() is None):
self.person.set_death_ref(ref)
else:
self.person.add_event_ref(ref)
if self.event.get_description() == "" and \
self.event.get_type() != gen.lib.EventType.CUSTOM:
self.event.get_type() != EventType.CUSTOM:
if self.family:
text = EVENT_FAMILY_STR % {
'event_name' : str(self.event.get_type()),
@ -2473,10 +2473,10 @@ class GrampsParser(UpdateCallback):
def stop_name(self, tag):
if self.in_witness:
# Parse witnesses created by older gramps
note = gen.lib.Note()
note = Note()
note.handle = create_id()
note.set(_("Witness name: %s") % tag)
note.type.set(gen.lib.NoteType.EVENT)
note.type.set(NoteType.EVENT)
note.private = self.event.private
self.db.add_note(note, self.trans)
#set correct change time
@ -2488,10 +2488,10 @@ class GrampsParser(UpdateCallback):
if self.alt_name:
# alternate name or former aka tag
if self.name.get_type() == "":
self.name.set_type(gen.lib.NameType.AKA)
self.name.set_type(NameType.AKA)
else:
if self.name.get_type() == "":
self.name.set_type(gen.lib.NameType.BIRTH)
self.name.set_type(NameType.BIRTH)
#same logic as bsddb upgrade for xml < 1.4.0 which will
#have a surnamepat and/or surname. From 1.4.0 surname has been
@ -2521,7 +2521,7 @@ class GrampsParser(UpdateCallback):
def stop_aka(self, tag):
if self.name.get_type() == "":
self.name.set_type(gen.lib.NameType.AKA)
self.name.set_type(NameType.AKA)
if not self.surnamepat:
#no patronymic, only add surname if present
if self.surname:
@ -2548,13 +2548,13 @@ class GrampsParser(UpdateCallback):
"""
Parse witnesses created by older gramps
"""
person = gen.lib.Person()
person = Person()
self.inaugurate_id(tag, PERSON_KEY, person)
# Add an EventRef from that person
# to this event using ROLE_WITNESS role
event_ref = gen.lib.EventRef()
event_ref = EventRef()
event_ref.ref = self.event.handle
event_ref.role.set(gen.lib.EventRoleType.WITNESS)
event_ref.role.set(EventRoleType.WITNESS)
person.event_ref_list.append(event_ref)
self.db.commit_person(person, self.trans, self.change)
@ -2612,19 +2612,19 @@ class GrampsParser(UpdateCallback):
def stop_cause(self, tag):
# The old event's cause is now an attribute
attr = gen.lib.Attribute()
attr.set_type(gen.lib.AttributeType.CAUSE)
attr = Attribute()
attr.set_type(AttributeType.CAUSE)
attr.set_value(tag)
self.event.add_attribute(attr)
def stop_gender(self, tag):
t = tag
if t == "M":
self.person.set_gender (gen.lib.Person.MALE)
self.person.set_gender (Person.MALE)
elif t == "F":
self.person.set_gender (gen.lib.Person.FEMALE)
self.person.set_gender (Person.FEMALE)
else:
self.person.set_gender (gen.lib.Person.UNKNOWN)
self.person.set_gender (Person.UNKNOWN)
def stop_stitle(self, tag):
self.source.title = tag
@ -2703,11 +2703,11 @@ class GrampsParser(UpdateCallback):
text = tag
# This is old XML. We no longer have "text" attribute in soure_ref.
# So we create a new note, commit, and add the handle to note list.
note = gen.lib.Note()
note = Note()
note.handle = create_id()
note.private = self.citation.private
note.set(text)
note.type.set(gen.lib.NoteType.SOURCE_TEXT)
note.type.set(NoteType.SOURCE_TEXT)
self.db.add_note(note, self.trans)
#set correct change time
self.db.commit_note(note, self.trans, self.change)
@ -2720,11 +2720,11 @@ class GrampsParser(UpdateCallback):
text = fix_spaces(self.scomments_list)
else:
text = tag
note = gen.lib.Note()
note = Note()
note.handle = create_id()
note.private = self.citation.private
note.set(text)
note.type.set(gen.lib.NoteType.CITATION)
note.type.set(NoteType.CITATION)
self.db.add_note(note, self.trans)
#set correct change time
self.db.commit_note(note, self.trans, self.change)
@ -2773,8 +2773,8 @@ class GrampsParser(UpdateCallback):
if self.name:
self.name.set_nick_name(tag)
elif self.person:
attr = gen.lib.Attribute()
attr.set_type(gen.lib.AttributeType.NICKNAME)
attr = Attribute()
attr.set_type(AttributeType.NICKNAME)
attr.set_value(tag)
self.person.add_attribute(attr)
@ -2795,7 +2795,7 @@ class GrampsParser(UpdateCallback):
else:
text = tag
self.note.set_styledtext(gen.lib.StyledText(text, self.note_tags))
self.note.set_styledtext(StyledText(text, self.note_tags))
# The order in this long if-then statement should reflect the
# DTD: most deeply nested elements come first.
@ -2929,7 +2929,7 @@ class GrampsParser(UpdateCallback):
tag_name = _(tag_name)
tag = self.db.get_tag_from_name(tag_name)
if tag is None:
tag = gen.lib.Tag()
tag = Tag()
tag.set_name(tag_name)
tag.set_priority(self.db.get_number_of_tags())
tag_handle = self.db.add_tag(tag, self.trans)

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More