* src/AddSpouse.py: fix gender selection
* src/DbPrompter.py: support other DB formats * src/GrampsBSDDB.py: BSDDB format, derived from GrampsDbBase * src/GrampsDbBase.py: base class for database classes * src/GrampsGEDDB.py: GEDCOM format, derived from GrampsDbBase * src/GrampsXMLDB.py: XML format, derived from GrampsDbBase * src/PeopleModel.py: handle rebuilds better * src/RelLib.py: use try_to_find_person_from_handle * src/WriteXML.py: use gramps ids instead of handles * src/const.py.in: handle family relations correctly * src/gramps_main.py: remove prefix settings * src/data/gnome-mime-application-x-gramps-xml.png: new icon * src/data/gramps.applications: support for x-gramps-xml * src/data/gramps.keys: support for x-gramps-xml * src/data/gramps.mime: support for x-gramps-xml * src/data/gramps.schemas: added event format * src/data/gramps.xml: support for x-gramps-xml * src/plugins/ReadGedcom.py: start of GEDDB support * src/plugins/WriteGedcom.py: start of GEDDB support svn: r3306
This commit is contained in:
parent
acd9d9ccff
commit
99ffd9cd52
@ -1,3 +1,24 @@
|
|||||||
|
2004-07-31 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
|
* src/AddSpouse.py: fix gender selection
|
||||||
|
* src/DbPrompter.py: support other DB formats
|
||||||
|
* src/GrampsBSDDB.py: BSDDB format, derived from GrampsDbBase
|
||||||
|
* src/GrampsDbBase.py: base class for database classes
|
||||||
|
* src/GrampsGEDDB.py: GEDCOM format, derived from GrampsDbBase
|
||||||
|
* src/GrampsXMLDB.py: XML format, derived from GrampsDbBase
|
||||||
|
* src/PeopleModel.py: handle rebuilds better
|
||||||
|
* src/RelLib.py: use try_to_find_person_from_handle
|
||||||
|
* src/WriteXML.py: use gramps ids instead of handles
|
||||||
|
* src/const.py.in: handle family relations correctly
|
||||||
|
* src/gramps_main.py: remove prefix settings
|
||||||
|
* src/data/gnome-mime-application-x-gramps-xml.png: new icon
|
||||||
|
* src/data/gramps.applications: support for x-gramps-xml
|
||||||
|
* src/data/gramps.keys: support for x-gramps-xml
|
||||||
|
* src/data/gramps.mime: support for x-gramps-xml
|
||||||
|
* src/data/gramps.schemas: added event format
|
||||||
|
* src/data/gramps.xml: support for x-gramps-xml
|
||||||
|
* src/plugins/ReadGedcom.py: start of GEDDB support
|
||||||
|
* src/plugins/WriteGedcom.py: start of GEDDB support
|
||||||
|
|
||||||
2004-07-30 Don Allingham <dallingham@users.sourceforge.net>
|
2004-07-30 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/const.py.in: fix relationship types
|
* src/const.py.in: fix relationship types
|
||||||
|
|
||||||
|
Binary file not shown.
@ -342,8 +342,7 @@ class AddSpouse:
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
def set_gender(self):
|
def set_gender(self):
|
||||||
family_type = const.family_relations[value][0]
|
if self.rel_type.get_active() == const.FAMILY_CIVIL_UNION:
|
||||||
if text == const.FAMILY_CIVIL_UNION:
|
|
||||||
if self.gender == RelLib.Person.male:
|
if self.gender == RelLib.Person.male:
|
||||||
self.sgender = RelLib.Person.female
|
self.sgender = RelLib.Person.female
|
||||||
else:
|
else:
|
||||||
|
@ -48,6 +48,9 @@ import Utils
|
|||||||
import const
|
import const
|
||||||
import QuestionDialog
|
import QuestionDialog
|
||||||
import Plugins
|
import Plugins
|
||||||
|
import GrampsBSDDB
|
||||||
|
import GrampsXMLDB
|
||||||
|
import GrampsGEDDB
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -144,8 +147,21 @@ class ExistingDbPrompter:
|
|||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
filename = choose.get_filename()
|
filename = choose.get_filename()
|
||||||
filetype = gnome.vfs.get_mime_type(filename)
|
filetype = gnome.vfs.get_mime_type(filename)
|
||||||
|
print filetype
|
||||||
|
|
||||||
if filetype == 'application/x-gramps':
|
if filetype == 'application/x-gramps':
|
||||||
choose.destroy()
|
choose.destroy()
|
||||||
|
self.parent.db = GrampsBSDDB.GrampsBSDDB()
|
||||||
|
self.parent.read_file(filename)
|
||||||
|
return 1
|
||||||
|
if filetype == 'application/x-gramps-xml' or filetype == 'text/xml' or filetype == 'application/x-gzip':
|
||||||
|
choose.destroy()
|
||||||
|
self.parent.db = GrampsXMLDB.GrampsXMLDB()
|
||||||
|
self.parent.read_file(filename)
|
||||||
|
return 1
|
||||||
|
if filetype == 'application/x-gedcom':
|
||||||
|
choose.destroy()
|
||||||
|
self.parent.db = GrampsGEDDB.GrampsGEDDB()
|
||||||
self.parent.read_file(filename)
|
self.parent.read_file(filename)
|
||||||
return 1
|
return 1
|
||||||
(junk,the_file) = os.path.split(filename)
|
(junk,the_file) = os.path.split(filename)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -268,6 +268,9 @@ def save_usetips(val):
|
|||||||
def get_iprefix():
|
def get_iprefix():
|
||||||
return get_string("/apps/gramps/preferences/iprefix")
|
return get_string("/apps/gramps/preferences/iprefix")
|
||||||
|
|
||||||
|
def get_eprefix():
|
||||||
|
return get_string("/apps/gramps/preferences/iprefix")
|
||||||
|
|
||||||
def save_iprefix(val):
|
def save_iprefix(val):
|
||||||
set_string_as_id_prefix("/apps/gramps/preferences/iprefix",val)
|
set_string_as_id_prefix("/apps/gramps/preferences/iprefix",val)
|
||||||
|
|
||||||
@ -283,6 +286,9 @@ def get_sprefix():
|
|||||||
def save_sprefix(val):
|
def save_sprefix(val):
|
||||||
set_string_as_id_prefix("/apps/gramps/preferences/sprefix",val)
|
set_string_as_id_prefix("/apps/gramps/preferences/sprefix",val)
|
||||||
|
|
||||||
|
def save_eprefix(val):
|
||||||
|
set_string_as_id_prefix("/apps/gramps/preferences/eprefix",val)
|
||||||
|
|
||||||
def get_pprefix():
|
def get_pprefix():
|
||||||
return get_string("/apps/gramps/preferences/pprefix")
|
return get_string("/apps/gramps/preferences/pprefix")
|
||||||
|
|
||||||
|
1186
gramps2/src/GrampsDbBase.py
Normal file
1186
gramps2/src/GrampsDbBase.py
Normal file
File diff suppressed because it is too large
Load Diff
102
gramps2/src/GrampsGEDDB.py
Normal file
102
gramps2/src/GrampsGEDDB.py
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
from RelLib import *
|
||||||
|
from GrampsDbBase import *
|
||||||
|
|
||||||
|
import ReadGedcom
|
||||||
|
import WriteGedcom
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GrampsGEDDB
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class GrampsGEDDB(GrampsDbBase):
|
||||||
|
"""GRAMPS database object. This object is a base class for other
|
||||||
|
objects."""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
"""creates a new GrampsDB"""
|
||||||
|
GrampsDbBase.__init__(self)
|
||||||
|
|
||||||
|
def load(self,name,callback):
|
||||||
|
self.person_map = {}
|
||||||
|
self.family_map = {}
|
||||||
|
self.place_map = {}
|
||||||
|
self.source_map = {}
|
||||||
|
self.media_map = {}
|
||||||
|
self.event_map = {}
|
||||||
|
self.metadata = {}
|
||||||
|
self.filename = name
|
||||||
|
self.id_trans = {}
|
||||||
|
self.eventnames = {}
|
||||||
|
self.undodb = []
|
||||||
|
|
||||||
|
ReadGedcom.importData(self,name)
|
||||||
|
|
||||||
|
self.bookmarks = self.metadata.get('bookmarks')
|
||||||
|
if self.bookmarks == None:
|
||||||
|
self.bookmarks = []
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
writer = WriteGedcom.GedcomWriter(self,self.get_default_person())
|
||||||
|
writer.export_data(self.filename)
|
||||||
|
|
||||||
|
def get_surnames(self):
|
||||||
|
a = {}
|
||||||
|
for person_id in self.get_person_keys():
|
||||||
|
p = self.try_to_find_person_from_handle(person_id)
|
||||||
|
a[p.get_primary_name().get_surname()] = 1
|
||||||
|
vals = a.keys()
|
||||||
|
vals.sort()
|
||||||
|
return vals
|
||||||
|
|
||||||
|
def get_eventnames(self):
|
||||||
|
names = self.eventnames.keys()
|
||||||
|
a = {}
|
||||||
|
for name in names:
|
||||||
|
a[unicode(name)] = 1
|
||||||
|
vals = a.keys()
|
||||||
|
vals.sort()
|
||||||
|
return vals
|
||||||
|
|
||||||
|
def remove_person_handle(self,handle,transaction):
|
||||||
|
# self.genderStats.uncount_person (self.person_map[handle])
|
||||||
|
if transaction != None:
|
||||||
|
old_data = self.person_map.get(handle)
|
||||||
|
transaction.add(PERSON_KEY,handle,old_data)
|
||||||
|
del self.person_map[handle]
|
||||||
|
|
||||||
|
def remove_source_handle(self,handle,transaction):
|
||||||
|
if transaction != None:
|
||||||
|
old_data = self.source_map.get(str(handle))
|
||||||
|
transaction.add(SOURCE_KEY,handle,old_data)
|
||||||
|
del self.source_map[str(handle)]
|
||||||
|
|
||||||
|
def remove_event_handle(self,handle,transaction):
|
||||||
|
if transaction != None:
|
||||||
|
old_data = self.event_map.get(str(handle))
|
||||||
|
transaction.add(EVENT_KEY,handle,old_data)
|
||||||
|
del self.event_map[str(handle)]
|
||||||
|
|
110
gramps2/src/GrampsXMLDB.py
Normal file
110
gramps2/src/GrampsXMLDB.py
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#
|
||||||
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
from RelLib import *
|
||||||
|
from GrampsDbBase import *
|
||||||
|
|
||||||
|
import ReadXML
|
||||||
|
import WriteXML
|
||||||
|
|
||||||
|
_UNDO_SIZE = 1000
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# ID regular expression
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
_id_reg = compile("%\d+d")
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# GrampsXMLDB
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
class GrampsXMLDB(GrampsDbBase):
|
||||||
|
"""GRAMPS database object. This object is a base class for other
|
||||||
|
objects."""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
"""creates a new GrampsDB"""
|
||||||
|
GrampsDbBase.__init__(self)
|
||||||
|
|
||||||
|
def load(self,name,callback):
|
||||||
|
self.person_map = {}
|
||||||
|
self.family_map = {}
|
||||||
|
self.place_map = {}
|
||||||
|
self.source_map = {}
|
||||||
|
self.media_map = {}
|
||||||
|
self.event_map = {}
|
||||||
|
self.metadata = {}
|
||||||
|
self.filename = name
|
||||||
|
self.id_trans = {}
|
||||||
|
self.eventnames = {}
|
||||||
|
self.undodb = []
|
||||||
|
|
||||||
|
ReadXML.importData(self,name)
|
||||||
|
|
||||||
|
self.bookmarks = self.metadata.get('bookmarks')
|
||||||
|
if self.bookmarks == None:
|
||||||
|
self.bookmarks = []
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
WriteXML.quick_write(self,self.filename)
|
||||||
|
|
||||||
|
def get_surnames(self):
|
||||||
|
a = {}
|
||||||
|
for person_id in self.get_person_keys():
|
||||||
|
p = self.try_to_find_person_from_handle(person_id)
|
||||||
|
a[p.get_primary_name().get_surname()] = 1
|
||||||
|
vals = a.keys()
|
||||||
|
vals.sort()
|
||||||
|
return vals
|
||||||
|
|
||||||
|
def get_eventnames(self):
|
||||||
|
names = self.eventnames.keys()
|
||||||
|
a = {}
|
||||||
|
for name in names:
|
||||||
|
a[unicode(name)] = 1
|
||||||
|
vals = a.keys()
|
||||||
|
vals.sort()
|
||||||
|
return vals
|
||||||
|
|
||||||
|
def remove_person_handle(self,handle,transaction):
|
||||||
|
# self.genderStats.uncount_person (self.person_map[handle])
|
||||||
|
if transaction != None:
|
||||||
|
old_data = self.person_map.get(handle)
|
||||||
|
transaction.add(PERSON_KEY,handle,old_data)
|
||||||
|
del self.person_map[handle]
|
||||||
|
|
||||||
|
def remove_source_handle(self,handle,transaction):
|
||||||
|
if transaction != None:
|
||||||
|
old_data = self.source_map.get(str(handle))
|
||||||
|
transaction.add(SOURCE_KEY,handle,old_data)
|
||||||
|
del self.source_map[str(handle)]
|
||||||
|
|
||||||
|
def remove_event_handle(self,handle,transaction):
|
||||||
|
if transaction != None:
|
||||||
|
old_data = self.event_map.get(str(handle))
|
||||||
|
transaction.add(EVENT_KEY,handle,old_data)
|
||||||
|
del self.event_map[str(handle)]
|
||||||
|
|
@ -89,7 +89,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
]
|
]
|
||||||
|
|
||||||
maps = self.db.get_people_view_maps()
|
maps = self.db.get_people_view_maps()
|
||||||
if maps[0] != None:
|
if maps[0] != None and len(maps[0]) != 0:
|
||||||
self.top_iter2path = maps[0]
|
self.top_iter2path = maps[0]
|
||||||
self.top_path2iter = maps[1]
|
self.top_path2iter = maps[1]
|
||||||
self.iter2path = maps[2]
|
self.iter2path = maps[2]
|
||||||
@ -137,7 +137,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for person_handle in self.db.get_person_keys():
|
for person_handle in self.db.get_person_keys():
|
||||||
|
|
||||||
person = self.db.try_to_find_person_from_handle(person_handle)
|
person = self.db.try_to_find_person_from_handle(person_handle)
|
||||||
surname = unicode(person.get_primary_name().get_surname())
|
surname = unicode(person.get_primary_name().get_surname())
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ class GrampsParser:
|
|||||||
self.db.set_researcher(self.owner)
|
self.db.set_researcher(self.owner)
|
||||||
if self.tempDefault != None:
|
if self.tempDefault != None:
|
||||||
id = self.tempDefault
|
id = self.tempDefault
|
||||||
person = self.db.find_person_from_gramps_id(id,self.trans)
|
person = self.find_person_by_gramps_id(id)
|
||||||
if person:
|
if person:
|
||||||
self.db.set_default_person_handle(person.get_handle())
|
self.db.set_default_person_handle(person.get_handle())
|
||||||
|
|
||||||
@ -602,15 +602,15 @@ class GrampsParser:
|
|||||||
self.tempDefault = attrs["default"]
|
self.tempDefault = attrs["default"]
|
||||||
|
|
||||||
def start_father(self,attrs):
|
def start_father(self,attrs):
|
||||||
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
person = self.find_person_by_gramps_id(self.map_gid(attrs["ref"]))
|
||||||
self.family.set_father_handle(person.get_handle())
|
self.family.set_father_handle(person.get_handle())
|
||||||
|
|
||||||
def start_mother(self,attrs):
|
def start_mother(self,attrs):
|
||||||
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
person = self.find_person_by_gramps_id(self.map_gid(attrs["ref"]))
|
||||||
self.family.set_mother_handle(person.get_handle())
|
self.family.set_mother_handle(person.get_handle())
|
||||||
|
|
||||||
def start_child(self,attrs):
|
def start_child(self,attrs):
|
||||||
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
person = self.find_person_by_gramps_id(self.map_gid(attrs["ref"]))
|
||||||
self.family.add_child_handle(person.get_handle())
|
self.family.add_child_handle(person.get_handle())
|
||||||
|
|
||||||
def start_url(self,attrs):
|
def start_url(self,attrs):
|
||||||
|
@ -1505,7 +1505,7 @@ class Person(SourceNote):
|
|||||||
for family_handle in person.get_family_handle_list():
|
for family_handle in person.get_family_handle_list():
|
||||||
family = db.find_family_from_handle(family_handle)
|
family = db.find_family_from_handle(family_handle)
|
||||||
for child_handle in family.get_child_handle_list():
|
for child_handle in family.get_child_handle_list():
|
||||||
child = db.find_person_from_handle(child_handle)
|
child = db.try_to_find_person_from_handle(child_handle)
|
||||||
if child.birth_handle:
|
if child.birth_handle:
|
||||||
child_birth = db.find_event_from_handle(child.birth_handle)
|
child_birth = db.find_event_from_handle(child.birth_handle)
|
||||||
if child_birth.get_date() != "":
|
if child_birth.get_date() != "":
|
||||||
@ -1538,7 +1538,7 @@ class Person(SourceNote):
|
|||||||
if not parent_id:
|
if not parent_id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
parent = db.find_person_from_handle(parent_id)
|
parent = db.try_to_find_person_from_handle(parent_id)
|
||||||
if parent.birth_handle:
|
if parent.birth_handle:
|
||||||
parent_birth = db.find_event_from_handle(parent.birth_handle)
|
parent_birth = db.find_event_from_handle(parent.birth_handle)
|
||||||
if parent_birth.get_date():
|
if parent_birth.get_date():
|
||||||
@ -1570,7 +1570,7 @@ class Person(SourceNote):
|
|||||||
continue
|
continue
|
||||||
if spouse_id == self.handle:
|
if spouse_id == self.handle:
|
||||||
continue
|
continue
|
||||||
spouse = db.find_person_from_handle(spouse_id)
|
spouse = db.try_to_find_person_from_handle(spouse_id)
|
||||||
if spouse.birth_handle:
|
if spouse.birth_handle:
|
||||||
spouse_birth = db.find_event_from_handle(spouse.birth_handle)
|
spouse_birth = db.find_event_from_handle(spouse.birth_handle)
|
||||||
if spouse_birth.get_date() != "":
|
if spouse_birth.get_date() != "":
|
||||||
@ -2309,13 +2309,3 @@ class GenderStats:
|
|||||||
return Person.unknown
|
return Person.unknown
|
||||||
|
|
||||||
|
|
||||||
from bsddb import dbshelve, db
|
|
||||||
|
|
||||||
def find_surname(key,data):
|
|
||||||
return str(data[3].get_surname())
|
|
||||||
|
|
||||||
def find_idmap(key,data):
|
|
||||||
return str(data[1])
|
|
||||||
|
|
||||||
def find_eventname(key,data):
|
|
||||||
return str(data[1])
|
|
||||||
|
@ -236,7 +236,7 @@ class XmlWriter:
|
|||||||
self.g.write(" <people")
|
self.g.write(" <people")
|
||||||
person = self.db.get_default_person()
|
person = self.db.get_default_person()
|
||||||
if person:
|
if person:
|
||||||
self.g.write(' default="%s"' % person.get_handle())
|
self.g.write(' default="%s"' % person.get_gramps_id())
|
||||||
self.g.write(">\n")
|
self.g.write(">\n")
|
||||||
|
|
||||||
keys = self.db.get_person_keys()
|
keys = self.db.get_person_keys()
|
||||||
@ -498,7 +498,7 @@ class XmlWriter:
|
|||||||
if ord.get_status() != 0:
|
if ord.get_status() != 0:
|
||||||
self.g.write('%s<status val="%d"/>\n' % (sp2,ord.get_status()))
|
self.g.write('%s<status val="%d"/>\n' % (sp2,ord.get_status()))
|
||||||
if ord.get_family_handle():
|
if ord.get_family_handle():
|
||||||
self.g.write('%s<sealed_to ref="%s"/>\n' % (sp2,self.fix(ord.get_family_handle().get_handle())))
|
self.g.write('%s<sealed_to ref="%s"/>\n' % (sp2,self.fix(ord.get_family_handle().get_gramps_id())))
|
||||||
if ord.get_note() != "":
|
if ord.get_note() != "":
|
||||||
self.write_note("note",ord.get_note_object(),index+1)
|
self.write_note("note",ord.get_note_object(),index+1)
|
||||||
for s in ord.get_source_references():
|
for s in ord.get_source_references():
|
||||||
@ -533,7 +533,7 @@ class XmlWriter:
|
|||||||
|
|
||||||
def write_id(self,label,person,index=1):
|
def write_id(self,label,person,index=1):
|
||||||
if person:
|
if person:
|
||||||
self.g.write('%s<%s id="%s"' % (" "*index,label,person.get_handle()))
|
self.g.write('%s<%s id="%s"' % (" "*index,label,person.get_gramps_id()))
|
||||||
comp = person.get_complete()
|
comp = person.get_complete()
|
||||||
if comp:
|
if comp:
|
||||||
self.g.write(' complete="1"')
|
self.g.write(' complete="1"')
|
||||||
@ -792,8 +792,8 @@ class XmlWriter:
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def sortById(first,second):
|
def sortById(first,second):
|
||||||
fid = first.get_handle()
|
fid = first.get_gramps_id()
|
||||||
sid = second.get_handle()
|
sid = second.get_gramps_id()
|
||||||
|
|
||||||
if fid < sid:
|
if fid < sid:
|
||||||
return -1
|
return -1
|
||||||
|
@ -483,7 +483,10 @@ def display_frel(st):
|
|||||||
return family_relations.find_value(st)
|
return family_relations.find_value(st)
|
||||||
|
|
||||||
def save_frel(st):
|
def save_frel(st):
|
||||||
return family_relations.find_key(st)
|
try:
|
||||||
|
return family_relations[st][0]
|
||||||
|
except:
|
||||||
|
return _("Unknown")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -9,6 +9,7 @@ dist_pkgdata_DATA = \
|
|||||||
gnome-mime-application-x-gramps.png \
|
gnome-mime-application-x-gramps.png \
|
||||||
gnome-mime-application-x-gedcom.png \
|
gnome-mime-application-x-gedcom.png \
|
||||||
gnome-mime-application-x-gramps-package.png \
|
gnome-mime-application-x-gramps-package.png \
|
||||||
|
gnome-mime-application-x-gramps-xml.png \
|
||||||
gramps.applications \
|
gramps.applications \
|
||||||
gramps.desktop \
|
gramps.desktop \
|
||||||
gramps.svg \
|
gramps.svg \
|
||||||
|
BIN
gramps2/src/data/gnome-mime-application-x-gramps-xml.png
Normal file
BIN
gramps2/src/data/gnome-mime-application-x-gramps-xml.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
@ -4,4 +4,4 @@ gramps
|
|||||||
can_open_multiple_files=false
|
can_open_multiple_files=false
|
||||||
expects_uris=false
|
expects_uris=false
|
||||||
requires_terminal=false
|
requires_terminal=false
|
||||||
mime_types=application/x-gramps,application/x-gedcom,application/x-gramps-package
|
mime_types=application/x-gramps,application/x-gedcom,application/x-gramps-package,application/x-gramps-xml
|
||||||
|
@ -20,6 +20,17 @@ application/x-gramps-package:
|
|||||||
icon-filename=/usr/share/gramps/gramps.png
|
icon-filename=/usr/share/gramps/gramps.png
|
||||||
open=gramps %f
|
open=gramps %f
|
||||||
|
|
||||||
|
application/x-gramps-xml:
|
||||||
|
description=GRAMPS XML database
|
||||||
|
default_action_type=application
|
||||||
|
short_list_application_ids=gramps
|
||||||
|
short_list_application_ids_for_novice_user_level=gramps
|
||||||
|
short_list_application_ids_for_intermediate_user_level=gramps
|
||||||
|
short_list_application_ids_for_advanced_user_level=gramps
|
||||||
|
category=Documents/Genealogy
|
||||||
|
icon-filename=/usr/share/gramps/gramps.png
|
||||||
|
open=gramps %f
|
||||||
|
|
||||||
application/x-gedcom:
|
application/x-gedcom:
|
||||||
description=GEDCOM
|
description=GEDCOM
|
||||||
default_action_type=application
|
default_action_type=application
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
application/x-gramps
|
application/x-gramps
|
||||||
ext: grdb
|
ext: grdb
|
||||||
|
|
||||||
|
application/x-gramps-xml
|
||||||
|
ext: gramps
|
||||||
|
|
||||||
application/x-gramps-package
|
application/x-gramps-package
|
||||||
ext: gpkg
|
ext: gpkg
|
||||||
|
|
||||||
|
@ -107,6 +107,19 @@
|
|||||||
</locale>
|
</locale>
|
||||||
</schema>
|
</schema>
|
||||||
|
|
||||||
|
<schema>
|
||||||
|
<key>/schemas/apps/gramps/preferences/eprefix</key>
|
||||||
|
<applyto>/apps/gramps/preferences/eprefix</applyto>
|
||||||
|
<owner>gramps</owner>
|
||||||
|
<type>string</type>
|
||||||
|
<default>E%04d</default>
|
||||||
|
<locale name="C">
|
||||||
|
<short>Default event GRAMPS ID pattern</short>
|
||||||
|
<long>The new GRAMPS IDs for the events are generated according
|
||||||
|
to this format string.</long>
|
||||||
|
</locale>
|
||||||
|
</schema>
|
||||||
|
|
||||||
<schema>
|
<schema>
|
||||||
<key>/schemas/apps/gramps/preferences/iprefix</key>
|
<key>/schemas/apps/gramps/preferences/iprefix</key>
|
||||||
<applyto>/apps/gramps/preferences/iprefix</applyto>
|
<applyto>/apps/gramps/preferences/iprefix</applyto>
|
||||||
|
@ -12,4 +12,8 @@
|
|||||||
<comment xml:lang="en">GRAMPS package</comment>
|
<comment xml:lang="en">GRAMPS package</comment>
|
||||||
<glob pattern="*.gpkg"/>
|
<glob pattern="*.gpkg"/>
|
||||||
</mime-type>
|
</mime-type>
|
||||||
|
<mime-type type="application/x-gramps-xml">
|
||||||
|
<comment xml:lang="en">GRAMPS XML database</comment>
|
||||||
|
<glob pattern="*.gramps"/>
|
||||||
|
</mime-type>
|
||||||
</mime-info>
|
</mime-info>
|
||||||
|
@ -53,6 +53,7 @@ import gtk.gdk
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import RelLib
|
import RelLib
|
||||||
import GrampsBSDDB
|
import GrampsBSDDB
|
||||||
|
import GrampsXMLDB
|
||||||
import PedView
|
import PedView
|
||||||
import MediaView
|
import MediaView
|
||||||
import PlaceView
|
import PlaceView
|
||||||
@ -130,11 +131,6 @@ class Gramps:
|
|||||||
self.hindex = -1
|
self.hindex = -1
|
||||||
|
|
||||||
self.db = GrampsBSDDB.GrampsBSDDB()
|
self.db = GrampsBSDDB.GrampsBSDDB()
|
||||||
self.db.set_iprefix(GrampsCfg.get_iprefix())
|
|
||||||
self.db.set_oprefix(GrampsCfg.get_oprefix())
|
|
||||||
self.db.set_fprefix(GrampsCfg.get_fprefix())
|
|
||||||
self.db.set_sprefix(GrampsCfg.get_sprefix())
|
|
||||||
self.db.set_pprefix(GrampsCfg.get_pprefix())
|
|
||||||
|
|
||||||
GrampsCfg.loadConfig()
|
GrampsCfg.loadConfig()
|
||||||
|
|
||||||
|
@ -129,6 +129,8 @@ def importData(database, filename, cb=None):
|
|||||||
# add some checking here
|
# add some checking here
|
||||||
|
|
||||||
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
|
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
|
||||||
|
if not os.path.isfile(glade_file):
|
||||||
|
glade_file = "plugins/gedcomimport.glade"
|
||||||
|
|
||||||
statusTop = gtk.glade.XML(glade_file,"status","gramps")
|
statusTop = gtk.glade.XML(glade_file,"status","gramps")
|
||||||
statusWindow = statusTop.get_widget("status")
|
statusWindow = statusTop.get_widget("status")
|
||||||
@ -219,6 +221,7 @@ class GedcomParser:
|
|||||||
self.broken_conc = 0
|
self.broken_conc = 0
|
||||||
self.is_ftw = 0
|
self.is_ftw = 0
|
||||||
self.idswap = {}
|
self.idswap = {}
|
||||||
|
self.gid2id = {}
|
||||||
|
|
||||||
self.f = open(file,"rU")
|
self.f = open(file,"rU")
|
||||||
self.filename = file
|
self.filename = file
|
||||||
@ -514,7 +517,7 @@ class GedcomParser:
|
|||||||
self.indi_count = self.indi_count + 1
|
self.indi_count = self.indi_count + 1
|
||||||
id = matches[1]
|
id = matches[1]
|
||||||
id = id[1:-1]
|
id = id[1:-1]
|
||||||
self.person = self.find_or_create_person(id)
|
self.person = self.find_or_create_person(self.map_gid(id))
|
||||||
self.added[self.person.get_handle()] = 1
|
self.added[self.person.get_handle()] = 1
|
||||||
self.parse_individual()
|
self.parse_individual()
|
||||||
self.db.commit_person(self.person, self.trans)
|
self.db.commit_person(self.person, self.trans)
|
||||||
@ -545,14 +548,23 @@ class GedcomParser:
|
|||||||
if self.idswap.get(id):
|
if self.idswap.get(id):
|
||||||
return self.idswap[id]
|
return self.idswap[id]
|
||||||
else:
|
else:
|
||||||
if self.db.idtrans.get(str(id)):
|
if self.db.id_trans.get(str(id)):
|
||||||
self.idswap[id] = self.db.find_next_gid()
|
self.idswap[id] = self.db.find_next_gid()
|
||||||
else:
|
else:
|
||||||
self.idswap[id] = id
|
self.idswap[id] = id
|
||||||
return self.idswap[id]
|
return self.idswap[id]
|
||||||
|
|
||||||
def find_or_create_person(self,id):
|
def find_or_create_person(self,gramps_id):
|
||||||
person = self.db.find_person_from_gramps_id(self.map_gid(id),self.trans)
|
person = RelLib.Person()
|
||||||
|
intid = self.gid2id.get(gramps_id)
|
||||||
|
if self.db.person_map.has_key(intid):
|
||||||
|
person.unserialize(self.db.person_map.get(intid))
|
||||||
|
else:
|
||||||
|
intid = Utils.create_id()
|
||||||
|
person.set_handle(intid)
|
||||||
|
person.set_gramps_id(gramps_id)
|
||||||
|
self.db.add_person_as(person,self.trans)
|
||||||
|
self.gid2id[gramps_id] = intid
|
||||||
return person
|
return person
|
||||||
|
|
||||||
def parse_cause(self,event,level):
|
def parse_cause(self,event,level):
|
||||||
@ -620,12 +632,12 @@ class GedcomParser:
|
|||||||
return
|
return
|
||||||
elif matches[1] == "HUSB":
|
elif matches[1] == "HUSB":
|
||||||
id = matches[2]
|
id = matches[2]
|
||||||
person = self.find_or_create_person(id[1:-1])
|
person = self.find_or_create_person(self.map_gid(id[1:-1]))
|
||||||
self.family.set_father_handle(person.get_handle())
|
self.family.set_father_handle(person.get_handle())
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "WIFE":
|
elif matches[1] == "WIFE":
|
||||||
id = matches[2]
|
id = matches[2]
|
||||||
person = self.find_or_create_person(id[1:-1])
|
person = self.find_or_create_person(self.map_gid(id[1:-1]))
|
||||||
self.family.set_mother_handle(person.get_handle())
|
self.family.set_mother_handle(person.get_handle())
|
||||||
self.ignore_sub_junk(2)
|
self.ignore_sub_junk(2)
|
||||||
elif matches[1] == "SLGS":
|
elif matches[1] == "SLGS":
|
||||||
@ -639,7 +651,7 @@ class GedcomParser:
|
|||||||
elif matches[1] == "CHIL":
|
elif matches[1] == "CHIL":
|
||||||
mrel,frel = self.parse_ftw_relations(2)
|
mrel,frel = self.parse_ftw_relations(2)
|
||||||
id = matches[2]
|
id = matches[2]
|
||||||
child = self.find_or_create_person(id[1:-1])
|
child = self.find_or_create_person(self.map_gid(id[1:-1]))
|
||||||
self.family.add_child_handle(child.get_handle())
|
self.family.add_child_handle(child.get_handle())
|
||||||
|
|
||||||
for f in child.get_parent_family_handle_list():
|
for f in child.get_parent_family_handle_list():
|
||||||
@ -1734,7 +1746,7 @@ class GedcomParser:
|
|||||||
new_key = prefix % val
|
new_key = prefix % val
|
||||||
new_pmax = max(new_pmax,val)
|
new_pmax = max(new_pmax,val)
|
||||||
|
|
||||||
person = self.db.find_person_from_handle(pid,self.trans)
|
person = self.db.try_to_find_person_from_handle(pid,self.trans)
|
||||||
|
|
||||||
# new ID is not used
|
# new ID is not used
|
||||||
if not self.db.has_person_handle(new_key):
|
if not self.db.has_person_handle(new_key):
|
||||||
@ -1743,7 +1755,7 @@ class GedcomParser:
|
|||||||
person.set_gramps_id(new_key)
|
person.set_gramps_id(new_key)
|
||||||
self.db.add_person(person,self.trans)
|
self.db.add_person(person,self.trans)
|
||||||
else:
|
else:
|
||||||
tp = self.db.find_person_from_handle(new_key,self.trans)
|
tp = self.db.try_to_find_person_from_handle(new_key,self.trans)
|
||||||
# same person, just change it
|
# same person, just change it
|
||||||
if person == tp:
|
if person == tp:
|
||||||
self.db.remove_person_handle(pid,self.trans)
|
self.db.remove_person_handle(pid,self.trans)
|
||||||
|
@ -374,6 +374,9 @@ class GedcomWriterOptionBox:
|
|||||||
self.adopt = GedcomInfo.ADOPT_EVENT
|
self.adopt = GedcomInfo.ADOPT_EVENT
|
||||||
|
|
||||||
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
|
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
|
||||||
|
if not os.path.isfile(glade_file):
|
||||||
|
glade_file = "plugins/gedcomexport.glade"
|
||||||
|
|
||||||
self.topDialog = gtk.glade.XML(glade_file,"gedcomExport","gramps")
|
self.topDialog = gtk.glade.XML(glade_file,"gedcomExport","gramps")
|
||||||
self.topDialog.signal_autoconnect({
|
self.topDialog.signal_autoconnect({
|
||||||
"gnu_free" : self.gnu_free,
|
"gnu_free" : self.gnu_free,
|
||||||
|
Loading…
Reference in New Issue
Block a user