From f76403891994fffacf4da3725c6657466bd1d431 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 30 Nov 2001 01:47:45 +0000 Subject: [PATCH] LDS handling added, bugs in media config/references fixed svn: r596 --- gramps/src/Config.py | 8 +- gramps/src/EditPerson.glade | 465 ++++++++++++++++++++++++++++++ gramps/src/EditPerson.py | 160 +++++++++- gramps/src/GrampsParser.py | 35 ++- gramps/src/ImageSelect.py | 7 +- gramps/src/MediaView.py | 2 + gramps/src/RelImage.py | 2 - gramps/src/RelLib.py | 67 +++++ gramps/src/WriteXML.py | 26 +- gramps/src/config.glade | 24 ++ gramps/src/plugins/WriteGedcom.py | 133 +++++---- 11 files changed, 863 insertions(+), 66 deletions(-) diff --git a/gramps/src/Config.py b/gramps/src/Config.py index ec124bac4..d4fc5f389 100644 --- a/gramps/src/Config.py +++ b/gramps/src/Config.py @@ -494,7 +494,7 @@ def on_propertybox_apply(obj,page): output_preference = output_obj.get_data(DATA) set_bool("/gramps/config/UseTabs",usetabs) - set_bool("/gramps/config/MakeReference",makeref) + set_bool("/gramps/config/MakeReference",mediaref) set_bool("/gramps/config/DisplayGlobal",globalprop) set_bool("/gramps/config/DisplayLocal",localprop) set_bool("/gramps/config/ShowCalendar",calendar) @@ -661,6 +661,7 @@ def display_preferences_box(db): index_vis = prefsTop.get_widget("show_child_id") tabs = prefsTop.get_widget("usetabs") mr = prefsTop.get_widget("mediaref") + mc = prefsTop.get_widget("mediacopy") dg = prefsTop.get_widget("globalprop") dl = prefsTop.get_widget("localprop") cal = prefsTop.get_widget("calendar") @@ -673,7 +674,10 @@ def display_preferences_box(db): auto.set_active(autoload) detail.set_active(show_detail) tabs.set_active(usetabs) - mr.set_active(mediaref) + if mediaref: + mr.set_active(1) + else: + mc.set_active(1) dg.set_active(globalprop) dl.set_active(localprop) cal.set_active(calendar) diff --git a/gramps/src/EditPerson.glade b/gramps/src/EditPerson.glade index ae7df6548..9a6bb0829 100644 --- a/gramps/src/EditPerson.glade +++ b/gramps/src/EditPerson.glade @@ -3947,6 +3947,471 @@ 0 0 + + + GtkTable + table28 + 6 + 3 + False + 0 + 0 + + + GtkLabel + label249 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 5 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + ldsbapdate + True + True + True + 0 + + + 1 + 2 + 2 + 3 + 5 + 5 + True + False + False + False + True + False + + + + + GtkCombo + ldsbaptemple + True + True + False + True + False + + + 2 + 3 + 2 + 3 + 5 + 5 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + combo-entry1 + True + True + True + 0 + + + + + + GtkLabel + label251 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 1 + 2 + 0 + 1 + 5 + 5 + False + False + False + False + True + False + + + + + GtkLabel + label252 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 2 + 3 + 0 + 1 + 5 + 5 + False + False + False + False + True + False + + + + + GtkLabel + label253 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 3 + 4 + 5 + 5 + False + False + False + False + True + False + + + + + GtkEntry + endowdate + True + True + True + 0 + + + 1 + 2 + 3 + 4 + 5 + 5 + True + False + False + False + True + False + + + + + GtkCombo + endowtemple + True + True + False + True + False + + + 2 + 3 + 3 + 4 + 5 + 5 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + entry3 + True + True + True + 0 + + + + + + GtkHSeparator + hseparator8 + + 2 + 3 + 1 + 2 + 5 + 2 + False + False + False + False + True + False + + + + + GtkHSeparator + hseparator7 + + 1 + 2 + 1 + 2 + 5 + 2 + False + False + False + False + True + False + + + + + GtkHSeparator + hseparator6 + + 0 + 1 + 1 + 2 + 5 + 2 + False + False + False + False + True + False + + + + + GtkEntry + sealdate + True + True + True + 0 + + + 1 + 2 + 4 + 5 + 5 + 5 + True + False + False + False + True + False + + + + + GtkCombo + sealtemple + True + True + False + True + False + + + 2 + 3 + 4 + 5 + 5 + 5 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + entry5 + True + True + True + 0 + + + + + + GtkLabel + label254 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 4 + 5 + 5 + 5 + False + False + False + False + True + False + + + + + GtkLabel + label250 + + GTK_JUSTIFY_LEFT + False + 0.5 + 0.5 + 5 + 5 + + 0 + 1 + 0 + 1 + 5 + 5 + False + False + True + False + True + False + + + + + GtkOptionMenu + sealparents + True + + + 0 + + 2 + 3 + 5 + 6 + 5 + 5 + False + False + False + False + True + False + + + + + GtkLabel + label255 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 1 + 2 + 5 + 6 + 5 + 5 + False + False + False + False + True + False + + + + + + GtkLabel + Notebook:tab + label248 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 9addeef55..d77c9e9f4 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -44,6 +44,7 @@ import GDK import const import utils import Config +import Date from RelLib import * import ImageSelect import sort @@ -176,7 +177,14 @@ class EditPerson: self.name_note = self.get_widget("name_note") self.name_source = self.get_widget("name_source") self.gid = self.get_widget("gid") - + self.ldsbap_date = self.get_widget("ldsbapdate") + self.ldsbap_temple = self.get_widget("ldsbaptemple") + self.ldsend_date = self.get_widget("endowdate") + self.ldsend_temple = self.get_widget("endowtemple") + self.ldsseal_date = self.get_widget("sealdate") + self.ldsseal_temple = self.get_widget("sealtemple") + self.ldsseal_fam = self.get_widget("sealparents") + self.elist = person.getEventList()[:] self.nlist = person.getAlternateNames()[:] self.alist = person.getAttributeList()[:] @@ -247,7 +255,58 @@ class EditPerson: self.notes_field.insert_defaults(person.getNote()) self.notes_field.set_word_wrap(1) + # lds stuff + ord = person.getLdsBaptism() + if ord: + self.ldsbap_temple.entry.set_text(ord.getTemple()) + self.ldsbap_date.set_text(ord.getDate()) + ord = person.getLdsEndowment() + if ord: + self.ldsend_temple.entry.set_text(ord.getTemple()) + self.ldsend_date.set_text(ord.getDate()) + + ord = person.getLdsSeal() + if ord: + self.ldsseal_temple.entry.set_text(ord.getTemple()) + self.ldsseal_date.set_text(ord.getDate()) + self.ldsfam = ord.getFamily() + else: + self.ldsfam = None + + myMenu = gtk.GtkMenu() + item = gtk.GtkMenuItem(_("None")) + item.set_data("f",None) + item.connect("activate",self.menu_changed) + item.show() + myMenu.append(item) + + index = 0 + hist = 0 + for fam in [person.getMainFamily()] + person.getAltFamilyList(): + if fam == None: + continue + f = fam.getFather() + m = fam.getMother() + if f and m: + name = _("%s and %s") % (Config.nameof(f),Config.nameof(m)) + elif f: + name = Config.nameof(f) + elif m: + name = Config.nameof(m) + else: + name = _("unknown") + item = gtk.GtkMenuItem(name) + item.set_data("f",fam) + item.connect("activate",self.menu_changed) + item.show() + myMenu.append(item) + index = index + 1 + if fam == self.ldsfam: + hist = index + self.ldsseal_fam.set_menu(myMenu) + self.ldsseal_fam.set_history(hist) + # draw lists self.redraw_event_list() self.redraw_attr_list() @@ -256,6 +315,9 @@ class EditPerson: self.redraw_url_list() self.window.show() + def menu_changed(self,obj): + self.ldsfam = obj.get_data("f") + def get_widget(self,str): """returns the widget related to the passed string""" return self.top.get_widget(str) @@ -463,6 +525,50 @@ class EditPerson: if self.pname.getNote() != name.getNote(): changed = 1 + date = self.ldsbap_date.get_text() + temple = self.ldsbap_temple.entry.get_text() + ord = self.person.getLdsBaptism() + if not ord: + if date or temple: + changed = 1 + else: + d = Date() + d.set(date) + if compare_dates(d,ord.getDateObj()) != 0: + changed = 1 + elif ord.getTemple() != temple: + changed = 1 + + date = self.ldsend_date.get_text() + temple = self.ldsend_temple.entry.get_text() + ord = self.person.getLdsEndowment() + if not ord: + if date or temple: + changed = 1 + else: + d = Date() + d.set(date) + if compare_dates(d,ord.getDateObj()) != 0: + changed = 1 + elif ord.getTemple() != temple: + changed = 1 + + date = self.ldsseal_date.get_text() + temple = self.ldsseal_temple.entry.get_text() + ord = self.person.getLdsSeal() + if not ord: + if date or temple or self.ldsfam: + changed = 1 + else: + d = Date() + d.set(date) + if compare_dates(d,ord.getDateObj()) != 0: + changed = 1 + elif ord.getTemple() != temple: + changed = 1 + elif ord.getFamily() != self.ldsfam: + changed = 1 + bplace = string.strip(self.bplace.get_text()) dplace = string.strip(self.dplace.get_text()) @@ -778,6 +884,40 @@ class EditPerson: self.person.setNote(text) utils.modified() + date = self.ldsbap_date.get_text() + temple = self.ldsbap_temple.entry.get_text() + ord = self.person.getLdsBaptism() + update_ord(self.person.setLdsBaptism,ord,date,temple) + + date = self.ldsend_date.get_text() + temple = self.ldsend_temple.entry.get_text() + ord = self.person.getLdsEndowment() + update_ord(self.person.setLdsEndowment,ord,date,temple) + + date = self.ldsseal_date.get_text() + temple = self.ldsseal_temple.entry.get_text() + ord = self.person.getLdsSeal() + if not ord: + if self.ldsfam or date or temple: + ord = LdsOrd() + ord.setDate(date) + ord.setTemple(temple) + ord.setFamily(self.ldsfam) + self.person.setLdsSeal(ord) + utils.modified() + else: + d = Date() + d.set(date) + if compare_dates(d,ord.getDateObj()) != 0: + ord.setDateObj(date) + utils.modified() + if ord.getTemple() != temple: + ord.setTemple(temple) + utils.modified() + if ord.getFamily() != self.ldsfam: + ord.setFamily(self.ldsfam) + utils.modified() + self.update_lists() if self.callback: self.callback(self) @@ -811,6 +951,24 @@ class EditPerson: self.not_loaded = 0 self.gallery.load_images() +def update_ord(func,ord,date,temple): + if not ord: + if (date or temple): + ord = LdsOrd() + ord.setDate(date) + ord.setTemple(temple) + func(ord) + utils.modified() + else: + d = Date() + d.set(date) + if compare_dates(d,ord.getDateObj()) != 0: + ord.setDateObj(d) + utils.modified() + elif ord.getTemple() != temple: + ord.setTemple(temple) + utils.modified() + #------------------------------------------------------------------------- # # diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py index dd334d967..4bb04d93e 100644 --- a/gramps/src/GrampsParser.py +++ b/gramps/src/GrampsParser.py @@ -59,6 +59,7 @@ class GrampsParser: self.tlist = [] self.conf = 2 + self.ord = None self.objref = None self.object = None self.pref = None @@ -117,7 +118,24 @@ class GrampsParser: if self.db.personMap.has_key(id): person = self.db.personMap[id] self.db.setDefaultPerson(person) - + + def start_lds_ord(self,attrs): + type = u2l(attrs['type']) + self.ord = LdsOrd() + if type == "baptism": + self.person.setLdsBaptism(self.ord) + elif type == "endowment": + self.person.setLdsEndowment(self.ord) + else: + self.person.setLdsSeal(self.ord) + + def start_temple(self,attrs): + self.ord.setTemple(u2l(attrs['val'])) + + def start_sealed_to(self,attrs): + id = u2l(attrs['ref']) + self.ord.setFamily(self.db.findFamilyNoMap(id)) + def start_place(self,attrs): if attrs.has_key('ref'): self.placeobj = self.db.findPlaceNoMap(u2l(attrs['ref'])) @@ -391,7 +409,9 @@ class GrampsParser: d.get_stop_date().setIsoDate(attrs['stop']) def start_dateval(self,attrs): - if self.address: + if self.ord: + d = self.ord.getDateObj() + elif self.address: d = self.address.getDateObj() else: d = self.event.getDateObj() @@ -405,10 +425,11 @@ class GrampsParser: d.get_start_date().setMode(attrs['type']) else: d.get_start_date().setMode(None) - def start_datestr(self,attrs): - if self.address: + if self.ord: + d = self.ord.getDateObj() + elif self.address: d = self.address.getDateObj() else: d = self.event.getDateObj() @@ -543,6 +564,9 @@ class GrampsParser: def stop_spage(self,tag): self.source_ref.setPage(u2l(tag)) + def stop_lds_ord(self,tag): + self.ord = None + def stop_spubinfo(self,tag): self.source.setPubInfo(u2l(tag)) @@ -699,6 +723,9 @@ class GrampsParser: "places" : (None, stop_places), "placeobj" : (start_placeobj,stop_placeobj), "location" : (start_location,None), + "lds_ord" : (start_lds_ord, stop_lds_ord), + "temple" : (start_temple, None), + "sealed_to" : (start_sealed_to, None), "coord" : (start_coord,None), "pos" : (start_pos, None), "postal" : (None, stop_postal), diff --git a/gramps/src/ImageSelect.py b/gramps/src/ImageSelect.py index b3858fbff..d5baf4a80 100644 --- a/gramps/src/ImageSelect.py +++ b/gramps/src/ImageSelect.py @@ -624,9 +624,10 @@ class GlobalMediaProperties: def button_press(self,obj,event): if len(obj.selection) <= 0: return - data = obj.get_row_data(obj.selection[0]) - if data != None: - data[0](data[1],data[2]) + if event.button == 1 and event.type == GDK._2BUTTON_PRESS: + data = obj.get_row_data(obj.selection[0]) + if data != None: + data[0](data[1],data[2]) def display_refs(self): index = 0 diff --git a/gramps/src/MediaView.py b/gramps/src/MediaView.py index 2c095432c..61e994fa0 100644 --- a/gramps/src/MediaView.py +++ b/gramps/src/MediaView.py @@ -29,6 +29,8 @@ from RelLib import * import utils import os import Config +import const +import RelImage from intl import gettext _ = gettext diff --git a/gramps/src/RelImage.py b/gramps/src/RelImage.py index d56ed3cf7..cb0efbb4a 100644 --- a/gramps/src/RelImage.py +++ b/gramps/src/RelImage.py @@ -80,8 +80,6 @@ def import_media_object(filename,path,base): try: path = "%s/%s" % (thumb,base) - - print filename,path,const.thumbScale mk_thumb(filename,path,const.thumbScale) shutil.copy(filename,name) except: diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index ea73b44ef..101134d41 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -87,6 +87,52 @@ class SourceNote: """Return in note instance, not just the text""" return self.note +class LdsOrd: + """LDS Ordinance support""" + def __init__(self,source=None): + if source: + self.famc = source.famc + self.date = Date(source.date) + self.temple = source.temple + else: + self.famc = None + self.date = None + self.temple = "" + + def setFamily(self,family): + self.famc = family + + def getFamily(self): + return self.famc + + def setDate(self, date) : + """attempts to sets the date of the LdsOrd instance""" + if not self.date: + self.date = Date() + self.date.set(date) + + def getDate(self) : + """returns a string representation of the date of the LdsOrd instance""" + if self.date: + return self.date.getDate() + return "" + + def getDateObj(self): + """returns the Date object associated with the LdsOrd""" + if not self.date: + self.date = Date() + return self.date + + def setDateObj(self,date): + """sets the Date object associated with the LdsOrd""" + self.date = date + + def setTemple(self,temple): + self.temple = temple + + def getTemple(self): + return self.temple + class DataObj(SourceNote): """Base class for data elements, providing source, note, and privacy data""" @@ -782,6 +828,9 @@ class Person: self.paf_uid = "" self.position = None self.ancestor = None + self.lds_bapt = None + self.lds_endow = None + self.lds_seal = None def setPrimaryName(self,name): """sets the primary name of the Person to the specified Name instance""" @@ -1031,6 +1080,24 @@ class Person: def getAncestor(self): return self.ancestor + def setLdsBaptism(self,ord): + self.lds_bapt = ord + + def getLdsBaptism(self): + return self.lds_bapt + + def setLdsEndowment(self,ord): + self.lds_endow = None + + def getLdsEndowment(self): + return self.lds_endow + + def setLdsSeal(self,ord): + self.lds_seal = ord + + def getLdsSeal(self): + return self.lds_seal + class Event(DataObj): """Event record, recording the event type, description, place, and date of a particular event""" diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index 30ee9c272..d0ab4f106 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -128,6 +128,27 @@ def dump_my_event(g,name,event,index=1): dump_source_ref(g,s,index+1) g.write("%s\n" % sp) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def dump_ordinance(g,name,ord,index=1): + if not ord: + return + + sp = " " * index + sp2 = " " * (index+1) + g.write('%s\n' % (sp,fix(name))) + dateobj = ord.getDateObj() + if dateobj != None and not dateobj.isEmpty(): + write_date(g,dateobj,index+1) + if ord.getTemple(): + g.write('%s\n' % (sp2,fix(ord.getTemple()))) + if ord.getFamily(): + g.write('%s\n' % (sp2,fix(ord.getFamily().getId()))) + g.write('%s\n' % sp) + #------------------------------------------------------------------------- # # @@ -520,6 +541,10 @@ def write_xml_data(database, g, callback, sp): dump_my_event(g,"Death",person.getDeath(),3) for event in person.getEventList(): dump_event(g,event,3) + + dump_ordinance(g,"baptism",person.getLdsBaptism(),3) + dump_ordinance(g,"endowment",person.getLdsEndowment(),3) + dump_ordinance(g,"sealed_to_parents",person.getLdsSeal(),3) write_photo_list(g,person.getPhotoList()) @@ -527,7 +552,6 @@ def write_xml_data(database, g, callback, sp): for address in person.getAddressList(): g.write(' \n' % conf_priv(address)) write_date(g,address.getDateObj(),4) -# write_line(g,"date",address.getDateObj().getSaveDate(),4) write_line(g,"street",address.getStreet(),4) write_line(g,"city",address.getCity(),4) write_line(g,"state",address.getState(),4) diff --git a/gramps/src/config.glade b/gramps/src/config.glade index 55bdd0f71..a49db0fd2 100644 --- a/gramps/src/config.glade +++ b/gramps/src/config.glade @@ -2004,6 +2004,12 @@ AbiWord mediaref 5 True + + toggled + on_object_toggled + propertybox + Fri, 30 Nov 2001 01:29:56 GMT + True True @@ -2020,6 +2026,12 @@ AbiWord mediacopy 5 True + + toggled + on_object_toggled + propertybox + Fri, 30 Nov 2001 01:30:09 GMT + False True @@ -2036,6 +2048,12 @@ AbiWord globalprop 5 True + + toggled + on_object_toggled + propertybox + Fri, 30 Nov 2001 01:30:24 GMT + True True @@ -2072,6 +2090,12 @@ AbiWord localprop 5 True + + toggled + on_object_toggled + propertybox + Fri, 30 Nov 2001 01:30:36 GMT + True True diff --git a/gramps/src/plugins/WriteGedcom.py b/gramps/src/plugins/WriteGedcom.py index 857a85fd4..d606e44fa 100644 --- a/gramps/src/plugins/WriteGedcom.py +++ b/gramps/src/plugins/WriteGedcom.py @@ -42,40 +42,46 @@ from latin_utf8 import latin_to_utf8 # GEDCOM feature support # #------------------------------------------------------------------------- -_ADOPT_NONE = 0 -_ADOPT_EVENT = 1 -_ADOPT_FTW = 2 -_ADOPT_LEGACY = 3 -_ADOPT_PEDI = 4 -_ADOPT_EVENT_EXT = 5 +_ADOP_NONE = 0 +_ADOP_EVENT = 1 +_ADOP_FTW = 2 +_ADOP_LEGACY = 3 +_ADOP_PEDI = 4 +_ADOP_EVEXT = 5 -_CONC_OK = 0 -_CONC_BROKEN = 1 +_CONC_OK = 0 +_CONC_BROKEN = 1 -_ALT_NONE = 0 -_ALT_STD = 1 -_ALT_ALIAS = 2 -_ALT_AKA = 3 -_ALT_EVENT_AKA = 4 +_ALT_NONE = 0 +_ALT_STD = 1 +_ALT_ALIAS = 2 +_ALT_AKA = 3 +_ALT_EVAKA = 4 -_CAL_NO = 0 -_CAL_YES = 1 +_CAL_NO = 0 +_CAL_YES = 1 -_EVEN_NONE = 0 -_EVEN_GED = 1 -_EVEN_FTW = 2 +_EVEN_NONE = 0 +_EVEN_GED = 1 +_EVEN_FTW = 2 + +_OBJE_NO = 0 +_OBJE_YES = 1 + +_RESI_ADDR = 0 +_RESI_PLAC = 1 targets = [ - ("Standard GEDCOM 5.5", "GEDCOM 5.5", _ADOPT_EVENT_EXT, _CONC_OK, _ALT_STD, _CAL_YES, _EVEN_GED), - ("Brother's Keeper", "BROSKEEP", _ADOPT_NONE, _CONC_OK, _ALT_NONE, _CAL_NO, _EVEN_GED), - ("Family Origins", "FamilyOrigins", _ADOPT_EVENT, _CONC_BROKEN, _ALT_EVENT_AKA, _CAL_NO, _EVEN_GED), - ("Family Tree Maker", "FTW", _ADOPT_FTW, _CONC_BROKEN, _ALT_ALIAS, _CAL_NO, _EVEN_FTW), - ("Ftree", "", _ADOPT_NONE, _CONC_BROKEN, _ALT_NONE, _CAL_NO, _EVEN_GED), - ("GeneWeb", "", _ADOPT_EVENT_EXT, _CONC_OK, _ALT_NONE, _CAL_YES, _EVEN_GED), - ("Legacy", "Legacy", _ADOPT_LEGACY, _CONC_BROKEN, _ALT_STD, _CAL_NO, _EVEN_GED), - ("Personal Ancestral File", "PAF", _ADOPT_PEDI, _CONC_OK, _ALT_AKA, _CAL_NO, _EVEN_GED), - ("Reunion", "REUNION", _ADOPT_NONE, _CONC_BROKEN, _ALT_NONE, _CAL_NO, _EVEN_GED), - ("Visual Genealogie", "", _ADOPT_NONE, _CONC_BROKEN, _ALT_NONE, _CAL_NO, _EVEN_GED), + ("Standard GEDCOM 5.5","GEDCOM 5.5",_ADOP_EVEXT,_CONC_OK,_ALT_STD,_CAL_YES,_EVEN_GED,_OBJE_YES,_RESI_ADDR), + ("Brother's Keeper","BROSKEEP",_ADOP_NONE,_CONC_OK,_ALT_NONE,_CAL_NO,_EVEN_GED,_OBJE_NO,_RESI_ADDR), + ("Family Origins","FamilyOrigins",_ADOP_EVENT,_CONC_BROKEN,_ALT_EVAKA,_CAL_NO,_EVEN_GED,_OBJE_NO,_RESI_ADDR), + ("Family Tree Maker","FTW",_ADOP_FTW,_CONC_BROKEN,_ALT_ALIAS,_CAL_NO,_EVEN_FTW,_OBJE_NO,_RESI_PLAC), + ("Ftree","",_ADOP_NONE,_CONC_BROKEN,_ALT_NONE,_CAL_NO,_EVEN_GED,_OBJE_NO,_RESI_ADDR), + ("GeneWeb","",_ADOP_EVEXT,_CONC_OK,_ALT_NONE,_CAL_YES,_EVEN_GED,_OBJE_NO,_RESI_ADDR), + ("Legacy","Legacy",_ADOP_LEGACY,_CONC_BROKEN,_ALT_STD,_CAL_NO,_EVEN_GED,_OBJE_NO,_RESI_ADDR), + ("Personal Ancestral File","PAF",_ADOP_PEDI,_CONC_OK,_ALT_AKA,_CAL_NO,_EVEN_GED,_OBJE_NO,_RESI_ADDR), + ("Reunion", "REUNION", _ADOP_NONE,_CONC_BROKEN,_ALT_NONE,_CAL_NO,_EVEN_GED,_OBJE_NO,_RESI_ADDR), + ("Visual Genealogie","",_ADOP_NONE,_CONC_BROKEN,_ALT_NONE,_CAL_NO,_EVEN_GED,_OBJE_NO,_RESI_ADDR), ] #------------------------------------------------------------------------- @@ -269,6 +275,17 @@ def add_persons_sources(person,slist,private): if sbase != None and sbase not in slist: slist.append(sbase) +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def addr_append(text,data): + if data: + return "%s, %s" % (text,data) + else: + return text + #------------------------------------------------------------------------- # # @@ -407,7 +424,7 @@ class GedcomWriter: self.plist = [] self.slist = [] self.flist = [] - self.adopt = _ADOPT_EVENT + self.adopt = _ADOP_EVENT self.fidval = 0 self.fidmap = {} self.pidval = 0 @@ -451,10 +468,10 @@ class GedcomWriter: target_obj = self.topDialog.get_widget("target") myMenu = gtk.GtkMenu() - for (name,dest,adopt,conc,alt,cal,even) in targets: + for (name,dest,adopt,conc,alt,cal,even,obje,resi) in targets: menuitem = gtk.GtkMenuItem(name) myMenu.append(menuitem) - menuitem.set_data("data",(dest,adopt,conc,alt,cal,even)) + menuitem.set_data("data",(dest,adopt,conc,alt,cal,even,obje,resi)) menuitem.show() target_obj.set_menu(myMenu) @@ -469,7 +486,7 @@ class GedcomWriter: filter = self.filter_menu.get_active().get_data("filter") act_tgt = self.target_menu.get_active() - (self.dest,self.adopt,self.conc,self.altname,self.cal,self.even) = act_tgt.get_data("data") + (self.dest,self.adopt,self.conc,self.altname,self.cal,self.even,self.obje,self.resi) = act_tgt.get_data("data") if self.topDialog.get_widget("ansel").get_active(): self.cnvtxt = latin_to_ansel @@ -622,7 +639,7 @@ class GedcomWriter: for person in family.getChildList(): self.g.write("1 CHIL @%s@\n" % self.pid(person.getId())) - if self.adopt == _ADOPT_FTW: + if self.adopt == _ADOP_FTW: if person.getMainFamily() == family: self.g.write('2 _FREL Natural\n') self.g.write('2 _MREL Natural\n') @@ -632,7 +649,7 @@ class GedcomWriter: self.g.write('2 _FREL %s\n' % f[2]) self.g.write('2 _MREL %s\n' % f[1]) break - if self.adopt == _ADOPT_LEGACY: + if self.adopt == _ADOP_LEGACY: for f in person.getAltFamilyList(): if f[0] == family: self.g.write('2 _STAT %s\n' % f[2]) @@ -711,7 +728,7 @@ class GedcomWriter: else: val = "" - if self.adopt == _ADOPT_EVENT and val == "ADOP": + if self.adopt == _ADOP_EVENT and val == "ADOP": ad = 1 self.g.write('1 ADOP\n') fam = None @@ -740,7 +757,7 @@ class GedcomWriter: self.dump_event_stats(event) - if self.adopt == _ADOPT_EVENT and ad == 0 and len(person.getAltFamilyList()) != 0: + if self.adopt == _ADOP_EVENT and ad == 0 and len(person.getAltFamilyList()) != 0: self.g.write('1 ADOP\n') fam = None for f in person.getAltFamilyList(): @@ -784,15 +801,24 @@ class GedcomWriter: datestr = addr.getDateObj().getSaveDate() if datestr != "": self.g.write("2 DATE %s\n" % self.cnvtxt(datestr)) - self.write_long_text("ADDR",2,addr.getStreet()) - if addr.getCity() != "": - self.g.write("3 CITY %s\n" % addr.getCity()) - if addr.getState() != "": - self.g.write("3 STAE %s\n" % addr.getState()) - if addr.getPostal() != "": - self.g.write("3 POST %s\n" % addr.getPostal()) - if addr.getCountry() != "": - self.g.write("3 CTRY %s\n" % addr.getCountry()) + if self.resi == 0: + self.write_long_text("ADDR",2,addr.getStreet()) + if addr.getCity() != "": + self.g.write("3 CITY %s\n" % addr.getCity()) + if addr.getState() != "": + self.g.write("3 STAE %s\n" % addr.getState()) + if addr.getPostal() != "": + self.g.write("3 POST %s\n" % addr.getPostal()) + if addr.getCountry() != "": + self.g.write("3 CTRY %s\n" % addr.getCountry()) + else: + text = addr.getStreet() + text = addr_append(text,addr.getCity()) + text = addr_append(text,addr.getState()) + text = addr_append(text,addr.getPostal()) + text = addr_append(text,addr.getCountry()) + if text: + self.g.write("2 PLAC %s\n" % text) if addr.getNote() != "": self.write_long_text("NOTE",3,addr.getNote()) for srcref in addr.getSourceRefList(): @@ -804,7 +830,7 @@ class GedcomWriter: for family in person.getAltFamilyList(): self.g.write("1 FAMC @%s@\n" % self.fid(family[0].getId())) - if self.adopt == _ADOPT_PEDI: + if self.adopt == _ADOP_PEDI: if string.lower(family[1]) == "adopted": self.g.write("2 PEDI Adopted\n") @@ -812,13 +838,14 @@ class GedcomWriter: if family != None and family in self.flist: self.g.write("1 FAMS @%s@\n" % self.fid(family.getId())) - for url in person.getUrlList(): - self.g.write('1 OBJE\n') - self.g.write('2 FORM URL\n') - if url.get_description() != "": - self.g.write('2 TITL %s\n' % url.get_description()) - if url.get_path() != "": - self.g.write('2 FILE %s\n' % url.get_path()) + if self.obje: + for url in person.getUrlList(): + self.g.write('1 OBJE\n') + self.g.write('2 FORM URL\n') + if url.get_description() != "": + self.g.write('2 TITL %s\n' % url.get_description()) + if url.get_path() != "": + self.g.write('2 FILE %s\n' % url.get_path()) if person.getNote() != "": self.write_long_text("NOTE",1,person.getNote())