2007-08-18 Don Allingham <don@gramps-project.org>

* src/GrampsDbUtils/_GedcomParse.py: fix event names, url type
	* src/GrampsDbUtils/_WriteGedcom.py: remove non-standard format types
	* src/GrampsDbUtils/gedcomexport.glade: remove non-standard format types



svn: r8836
This commit is contained in:
Don Allingham 2007-08-19 03:25:07 +00:00
parent 1a2e9e96df
commit c951994948
4 changed files with 38 additions and 100 deletions

View File

@ -1,3 +1,8 @@
2007-08-18 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_GedcomParse.py: fix event names, url type
* src/GrampsDbUtils/_WriteGedcom.py: remove non-standard format types
* src/GrampsDbUtils/gedcomexport.glade: remove non-standard format types
2007-08-18 Brian Matherly <brian@gramps-project.org>
* src/plugins/KinshipReport.py: fix typo nefew -> nephew
* src/Relationship.py: fix typo nefew -> nephew

View File

@ -343,13 +343,12 @@ class GedcomParser(UpdateCallback):
UpdateCallback.__init__(self, callback)
self.set_total(stage_one.get_line_count())
self.repo2id = {}
self.maxpeople = stage_one.get_person_count()
self.dbase = dbase
self.emapper = GedcomUtils.IdFinder(dbase.get_gramps_ids(EVENT_KEY),
dbase.eprefix)
self.empty_cref = RelLib.ChildRef()
self.famc_map = stage_one.get_famc_map()
self.fams_map = stage_one.get_fams_map()
@ -2276,13 +2275,17 @@ class GedcomParser(UpdateCallback):
ref.set_mother_relation(sub_state.ftype)
ref.set_father_relation(sub_state.ftype)
break
else:
ref = RelLib.ChildRef()
ref.ref = state.person.handle
else:
# We are cheating here. Profing has indicated that the ChildRef
#constructor can consume a lot of time. So, we created a generic
# ChildRef in the class and we just modify it and assign it.
# We use the fact that only the ref field is used, and a copy of
# this is made elsewhere.
self.empty_cref.ref = state.person.handle
if sub_state.ftype:
ref.set_mother_relation(sub_state.ftype)
ref.set_father_relation(sub_state.ftype)
family.add_child_ref(ref)
family.add_child_ref(self.empty_cref)
self.dbase.commit_family(family, self.trans)
def __person_famc_pedi(self, line, state):
@ -4380,6 +4383,7 @@ class GedcomParser(UpdateCallback):
url = RelLib.Url()
url.set_path(filename)
url.set_description(title)
url.set_type(RelLib.UrlType.WEB_HOME)
obj.add_url(url)
else:
(valid, path) = self.__find_file(filename, self.dir_path)
@ -4514,7 +4518,7 @@ def person_event_name(event, person):
event.set_description(text)
def family_event_name(event, family, dbase):
if not event.get_description():
if not event.get_description() or event.get_description() == "Y":
text = EVENT_FAMILY_STR % {
'event_name' : str(event.get_type()),
'family' : Utils.family_name(family, dbase),

View File

@ -258,7 +258,6 @@ class GedcomWriterOptionBox:
def get_option_box(self):
self.restrict = True
self.adopt = GedcomInfo.ADOPT_EVENT
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
if not os.path.isfile(glade_file):
@ -305,7 +304,6 @@ class GedcomWriterOptionBox:
gedmap = GedcomInfo.GedcomInfoDB()
target_obj = self.topDialog.get_widget("target")
myMenu = gtk.Menu()
for name in gedmap.get_name_list():
menuitem = gtk.MenuItem(name)
@ -314,9 +312,6 @@ class GedcomWriterOptionBox:
menuitem.set_data("data", data)
menuitem.show()
target_obj.set_menu(myMenu)
self.target_menu = myMenu
the_box = self.topDialog.get_widget('vbox1')
the_parent = self.topDialog.get_widget('dialog-vbox1')
the_parent.remove(the_box)
@ -333,7 +328,7 @@ class GedcomWriterOptionBox:
def parse_options(self):
self.restrict = self.topDialog.get_widget("restrict").get_active()
self.living = (self.restrict and
self.living = (self.restrict and
self.topDialog.get_widget("living").get_active())
self.exclnotes = (self.restrict and
self.topDialog.get_widget("notes").get_active())
@ -341,9 +336,7 @@ class GedcomWriterOptionBox:
self.topDialog.get_widget("sources").get_active())
self.cfilter = self.filter_menu.get_active().get_data("filter")
act_tgt = self.target_menu.get_active()
self.target_ged = act_tgt.get_data("data")
self.images = self.topDialog.get_widget ("images").get_active ()
if self.images:
images_path = self.topDialog.get_widget ("images_path")
@ -351,8 +344,6 @@ class GedcomWriterOptionBox:
else:
self.images_path = ""
self.adopt = self.target_ged.get_adopt()
#-------------------------------------------------------------------------
#
# GedcomWriter class
@ -378,6 +369,9 @@ class GedcomWriter(UpdateCallback):
if not setup_func():
return
gedmap = GedcomInfo.GedcomInfoDB()
self.target_ged = gedmap.standard
self.flist = set()
self.slist = set()
self.rlist = set()
@ -416,8 +410,6 @@ class GedcomWriter(UpdateCallback):
self.exclsrcs = self.option_box.exclsrcs
self.images = self.option_box.images
self.images_path = self.option_box.images_path
self.target_ged = self.option_box.target_ged
self.adopt = self.option_box.adopt
if self.option_box.cfilter == None:
self.plist = set(self.db.get_person_handles(sort_handles=False))
@ -441,8 +433,6 @@ class GedcomWriter(UpdateCallback):
gedmap = GedcomInfo.GedcomInfoDB()
self.target_ged = gedmap.standard
self.adopt = self.target_ged.get_adopt()
return True
def export_data(self, filename):
@ -580,8 +570,7 @@ class GedcomWriter(UpdateCallback):
sorted.sort()
for data in sorted:
person = self.db.get_person_from_handle(data[1])
self.__write_person(person)
self.__write_person(self.db.get_person_from_handle(data[1]))
self.update()
def __write_person(self, person):
@ -742,7 +731,14 @@ class GedcomWriter(UpdateCallback):
self.__writeln(3, 'ADOP', 'HUSB')
def __write_attributes(self, person):
for attr in person.get_attribute_list():
# filter out the Nicknames, since they have already been
# processed.
attr_list = [ attr for attr in person.get_attribute_list()
if attr.get_type() != RelLib.AttributeType.NICKNAME ]
for attr in attr_list:
t = int(attr.get_type())
name = GedcomInfo.personalConstantAttributes.get(t)
@ -805,14 +801,6 @@ class GedcomWriter(UpdateCallback):
family = self.db.get_family_from_handle(family_handle)
family_id = family.get_gramps_id()
self.__writeln(1, 'FAMC', '@%s@' % family_id)
if self.adopt == GedcomInfo.ADOPT_PEDI:
# Go over all children of the family to find the ref
for child_ref in family.get_child_ref_list():
if child_ref.ref == person.handle:
if (child_ref.frel == RelLib.ChildRefType.ADOPTED) \
or (child_ref.mrel == RelLib.ChildRefType.ADOPTED):
self.__writeln(2, 'PEDI', 'Adopted')
break
def __write_parent_families(self, person):
for family_handle in person.get_family_handle_list():

View File

@ -92,7 +92,7 @@
<widget class="GtkTable" id="table3">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">7</property>
<property name="n_rows">6</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -177,65 +177,6 @@
</packing>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">_Target:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">target</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="target">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">0</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget2">
<property name="visible">True</property>
<child>
<widget class="GtkMenuItem" id="convertwidget3">
<property name="visible">True</property>
<property name="label" translatable="yes">Standard GEDCOM 5.5</property>
<property name="use_underline">True</property>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="private">
<property name="border_width">3</property>
@ -252,8 +193,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -276,8 +217,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -375,8 +316,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
</packing>
</child>
@ -428,8 +369,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
</packing>
</child>