diff --git a/gramps/src/plugins/ReorderIds.py b/gramps/src/plugins/ReorderIds.py new file mode 100644 index 000000000..23b80c84e --- /dev/null +++ b/gramps/src/plugins/ReorderIds.py @@ -0,0 +1,80 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000 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 +# + +"Database Processing/Reorder gramps IDs" + +import utils +import intl + +_ = intl.gettext + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def runTool(database,active_person,callback): + + for prefix in ["xyzzytemporaryid%d", "I%d"] : + index = 0 + pmap = database.getPersonMap() + for id in pmap.keys(): + newid = prefix % index + person = pmap[id] + person.setId(newid) + pmap[newid] = person + del pmap[id] + index = index + 1 + + for prefix in ["xyzzytemporaryid%d", "F%d"] : + index = 0 + pmap = database.getFamilyMap() + for id in pmap.keys(): + newid = prefix % index + person = pmap[id] + person.setId(newid) + pmap[newid] = person + del pmap[id] + index = index + 1 + + for prefix in ["xyzzytemporaryid%d", "S%d"] : + index = 0 + pmap = database.getSourceMap() + for id in pmap.keys(): + newid = prefix % index + person = pmap[id] + person.setId(newid) + pmap[newid] = person + del pmap[id] + index = index + 1 + + utils.modified() + callback(1) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def get_description(): + return _("Reorders the gramps IDs according to gramps' default rules.") + +def get_name(): + return _("Database Processing/Reorder gramps IDs") diff --git a/gramps/src/plugins/WriteGedcom.py b/gramps/src/plugins/WriteGedcom.py index a201ef0c6..941553d81 100644 --- a/gramps/src/plugins/WriteGedcom.py +++ b/gramps/src/plugins/WriteGedcom.py @@ -194,11 +194,12 @@ def walk(person): #------------------------------------------------------------------------- def add_persons_sources(person): elist = person.getEventList()[:] - if person.getBirth(): - elist.append(person.getBirth()) - if person.getDeath(): - elist.append(person.getDeath()) + + elist.append(person.getBirth()) + elist.append(person.getDeath()) for event in elist: + if private and event.getPrivacy(): + continue source_ref = event.getSourceRef() if source_ref != None: source_list.append(source_ref) @@ -209,12 +210,9 @@ def add_persons_sources(person): # #------------------------------------------------------------------------- def add_familys_sources(family): - elist = family.getEventList()[:] - if family.getMarriage(): - elist.append(family.getMarriage()) - if family.getDivorce(): - elist.append(family.getDivorce()) - for event in elist: + for event in family.getEventList(): + if private and event.getPrivacy(): + continue source_ref = event.getSourceRef() if source_ref != None: source_list.append(source_ref) @@ -369,20 +367,24 @@ def write_person(g,person): if not probably_alive(person): birth = person.getBirth() - if birth.getSaveDate() != "" or birth.getPlace() != "": - g.write("1 BIRT\n") - dump_event_stats(g,birth) + if not (private and birth.getPrivacy()): + if birth.getSaveDate() != "" or birth.getPlace() != "": + g.write("1 BIRT\n") + dump_event_stats(g,birth) death = person.getDeath() - if death.getSaveDate() != "" or death.getPlace() != "": - g.write("1 DEAT\n") - dump_event_stats(g,death) + if not (private and death.getPrivacy()): + if death.getSaveDate() != "" or death.getPlace() != "": + g.write("1 DEAT\n") + dump_event_stats(g,death) uid = person.getPafUid() if uid != "": g.write("1 _UID %s\n" % uid) for event in person.getEventList(): + if private and event.getPrivacy(): + continue name = event.getName() if const.personalConstantEvents.has_key(name): val = const.personalConstantEvents[name] @@ -396,6 +398,8 @@ def write_person(g,person): dump_event_stats(g,event) for attr in person.getAttributeList(): + if private and attr.getPrivacy(): + continue name = attr.getType() if const.personalConstantAttributes.has_key(name): val = const.personalConstantAttributes[name] @@ -413,6 +417,8 @@ def write_person(g,person): write_source_ref(g,2,attr.getSourceRef()) for addr in person.getAddressList(): + if private and addr.getPrivacy(): + continue write_long_text(g,"RESI",1,addr.getStreet()) if addr.getCity() != "": g.write("2 CITY %s\n" % addr.getCity()) @@ -512,17 +518,9 @@ def exportData(database, filename): father = family.getFather() mother = family.getMother() if not probably_alive(father) or not probably_alive(mother): - event = family.getMarriage() - if event != None: - g.write("1 MARR\n"); - dump_event_stats(g,event) - - event = family.getDivorce() - if event != None: - g.write("1 DIV\n"); - dump_event_stats(g,event) - for event in family.getEventList(): + if private and event.getPrivacy(): + continue name = event.getName() if const.familyConstantEvents.has_key(name): @@ -618,9 +616,11 @@ def on_ok_clicked(obj): global db global topDialog global restrict + global private global cnvtxt restrict = topDialog.get_widget("restrict").get_active() + private = topDialog.get_widget("private").get_active() filter_obj = topDialog.get_widget("filter").get_menu().get_active() filter = filter_obj.get_data("filter") diff --git a/gramps/src/plugins/gedcomexport.glade b/gramps/src/plugins/gedcomexport.glade index 9d7e33863..9c1469355 100644 --- a/gramps/src/plugins/gedcomexport.glade +++ b/gramps/src/plugins/gedcomexport.glade @@ -239,13 +239,40 @@ - GtkCheckButton - restrict - 5 - True - - True - True + GtkVBox + vbox3 + False + 0 + + + GtkCheckButton + private + 3 + True + + True + True + + 0 + False + False + + + + + GtkCheckButton + restrict + 3 + True + + True + True + + 0 + False + False + +