Reordering gramps's ids and privacy fixes for gedcom export
svn: r306
This commit is contained in:
parent
b90aeaa04a
commit
19012d3832
80
gramps/src/plugins/ReorderIds.py
Normal file
80
gramps/src/plugins/ReorderIds.py
Normal file
@ -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")
|
@ -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())
|
||||
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,11 +367,13 @@ def write_person(g,person):
|
||||
if not probably_alive(person):
|
||||
|
||||
birth = person.getBirth()
|
||||
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 not (private and death.getPrivacy()):
|
||||
if death.getSaveDate() != "" or death.getPlace() != "":
|
||||
g.write("1 DEAT\n")
|
||||
dump_event_stats(g,death)
|
||||
@ -383,6 +383,8 @@ def write_person(g,person):
|
||||
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")
|
||||
|
||||
|
@ -238,14 +238,41 @@
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>private</name>
|
||||
<border_width>3</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Do not include records marked "Private"</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkCheckButton</class>
|
||||
<name>restrict</name>
|
||||
<border_width>5</border_width>
|
||||
<border_width>3</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<label>Restrict data on living people</label>
|
||||
<active>True</active>
|
||||
<draw_indicator>True</draw_indicator>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
Reference in New Issue
Block a user