Merge changes made in gramps20 into HEAD
svn: r4549
This commit is contained in:
@@ -57,6 +57,11 @@ from QuestionDialog import OkDialog, MissingMediaDialog
|
||||
def runTool(database,active_person,callback,parent=None):
|
||||
|
||||
try:
|
||||
if database.readonly:
|
||||
# TODO: split plugin in a check and repair part to support
|
||||
# checking of a read only database
|
||||
return
|
||||
|
||||
trans = database.transaction_begin()
|
||||
trans.set_batch(True)
|
||||
database.disable_signals()
|
||||
@@ -68,7 +73,7 @@ def runTool(database,active_person,callback,parent=None):
|
||||
|
||||
while prev_total != total:
|
||||
prev_total = total
|
||||
|
||||
|
||||
checker.check_for_broken_family_links()
|
||||
checker.check_parent_relationships()
|
||||
checker.cleanup_empty_families(0)
|
||||
@@ -294,9 +299,27 @@ class CheckIntegrity:
|
||||
def cleanup_empty_families(self,automatic):
|
||||
for family_handle in self.db.get_family_handles():
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
if not family.get_father_handle() and not family.get_mother_handle():
|
||||
father_handle = family.get_father_handle()
|
||||
mother_handle = family.get_mother_handle()
|
||||
|
||||
if not father_handle and not mother_handle:
|
||||
self.empty_family.append(family_handle)
|
||||
self.delete_empty_family(family_handle)
|
||||
continue
|
||||
elif not father_handle and len(family.get_child_handle_list()) == 0:
|
||||
person = self.db.get_person_from_handle(mother_handle)
|
||||
person.remove_family_handle(family_handle)
|
||||
self.db.commit_person(person,self.trans)
|
||||
self.db.remove_family(family_handle,self.trans)
|
||||
self.empty_family.append(family_handle)
|
||||
continue
|
||||
elif not mother_handle and len(family.get_child_handle_list()) == 0:
|
||||
person = self.db.get_person_from_handle(father_handle)
|
||||
person.remove_family_handle(family_handle)
|
||||
self.db.commit_person(person,self.trans)
|
||||
self.db.remove_family(family_handle,self.trans)
|
||||
self.empty_family.append(family_handle)
|
||||
continue
|
||||
|
||||
def delete_empty_family(self,family_handle):
|
||||
for key in self.db.get_person_handles(sort_handles=False):
|
||||
@@ -464,7 +487,10 @@ class CheckIntegrity:
|
||||
else:
|
||||
cn = _("Non existing person")
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
pn = Utils.family_name(family,self.db)
|
||||
if family:
|
||||
pn = Utils.family_name(family,self.db)
|
||||
else:
|
||||
pn = family_handle
|
||||
self.text.write('\t')
|
||||
self.text.write(_("%s was restored to the family of %s\n") % (cn,pn))
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ class FilterEditor:
|
||||
|
||||
def on_help_clicked(self,obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
help_display('gramps-manual','tools-util')
|
||||
help_display('gramps-manual','tools-util-cfe')
|
||||
|
||||
def on_delete_event(self,obj,b):
|
||||
self.filterdb.save()
|
||||
@@ -490,7 +490,7 @@ class EditFilter:
|
||||
|
||||
def on_help_clicked(self,obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
help_display('gramps-manual','tools-util')
|
||||
help_display('gramps-manual','tools-util-cfe')
|
||||
|
||||
def on_delete_event(self,obj,b):
|
||||
self.close_child_windows()
|
||||
|
||||
@@ -729,6 +729,7 @@ class GraphVizOptions(ReportOptions.ReportOptions):
|
||||
self.options_dict['pagesv'] = self.vpages_sb.get_value_as_int()
|
||||
self.options_dict['showfamily'] = int(self.show_families_cb.get_active())
|
||||
self.options_dict['incid'] = int(self.includeid_cb.get_active())
|
||||
self.options_dict['justyears'] = int(self.just_years_cb.get_active())
|
||||
self.options_dict['placecause'] = int(self.place_cause_cb.get_active())
|
||||
self.options_dict['rankdir'] = \
|
||||
_options.rankdir[self.rank_box.get_active()][0]
|
||||
|
||||
@@ -86,9 +86,8 @@ def importData(database, filename, cb=None):
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
# For a description of the file format see
|
||||
# http://cristal.inria.fr/~ddr/GeneWeb/en/gwformat.htm
|
||||
#-------------------------------------------------------------------------
|
||||
class GeneWebParser:
|
||||
def __init__(self, dbase, file):
|
||||
@@ -255,7 +254,8 @@ class GeneWebParser:
|
||||
birth_handle = child.get_birth_handle()
|
||||
birth = self.db.get_event_from_handle(birth_handle)
|
||||
if not birth:
|
||||
birth = RelLib.Event()
|
||||
birth = self.create_event("Birth")
|
||||
child.set_birth_handle(birth.get_handle())
|
||||
birth.set_place_handle(self.current_child_birthplace_handle)
|
||||
self.db.commit_event(birth,self.trans)
|
||||
if self.current_child_source_handle:
|
||||
@@ -450,14 +450,14 @@ class GeneWebParser:
|
||||
while idx < len(fields) and personDataRe.match(fields[idx]):
|
||||
if fields[idx][0] == '(':
|
||||
#print "Public Name: %s" % fields[idx]
|
||||
public_name = self.decode(fields[idx])
|
||||
public_name = self.decode(fields[idx][1:-1])
|
||||
idx = idx + 1
|
||||
elif fields[idx][0] == '{':
|
||||
#print "Firstsname Alias: %s" % fields[idx]
|
||||
firstname_aliases.append(self.decode(fields[idx]))
|
||||
firstname_aliases.append(self.decode(fields[idx][1:-1]))
|
||||
idx = idx + 1
|
||||
elif fields[idx][0] == '[':
|
||||
#print "Titles: %s" % fields[idx]
|
||||
print "TODO: Titles: %s" % fields[idx]
|
||||
idx = idx + 1
|
||||
elif fields[idx] == '#nick':
|
||||
idx = idx + 1
|
||||
@@ -672,7 +672,7 @@ class GeneWebParser:
|
||||
def get_or_create_place(self,place_name):
|
||||
place = None
|
||||
if place_name in self.pkeys:
|
||||
person = self.db.get_place_from_handle(self.pkeys[place_name])
|
||||
place = self.db.get_place_from_handle(self.pkeys[place_name])
|
||||
else:
|
||||
place = RelLib.Place()
|
||||
place.set_title(place_name)
|
||||
|
||||
@@ -106,13 +106,25 @@ class PatchNames:
|
||||
for key in self.db.get_person_handles(sort_handles=False):
|
||||
|
||||
person = self.db.get_person_from_handle(key)
|
||||
first = person.get_primary_name().get_first_name()
|
||||
sname = person.get_primary_name().get_surname()
|
||||
name = person.get_primary_name()
|
||||
first = name.get_first_name()
|
||||
sname = name.get_surname()
|
||||
|
||||
match = _title_re.match(first)
|
||||
if match:
|
||||
if name.get_title():
|
||||
current_title = [name.get_title()]
|
||||
else:
|
||||
current_title = []
|
||||
while match:
|
||||
groups = match.groups()
|
||||
self.title_list.append((key,groups[0],groups[1]))
|
||||
first = groups[1]
|
||||
current_title.append(groups[0])
|
||||
match = _title_re.match(first)
|
||||
|
||||
if current_title:
|
||||
self.title_list.append((key," ".join(current_title),first))
|
||||
continue
|
||||
|
||||
match = _nick_re.match(first)
|
||||
if match:
|
||||
groups = match.groups()
|
||||
|
||||
@@ -39,6 +39,7 @@ from gettext import gettext as _
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import Utils
|
||||
import RelLib
|
||||
from QuestionDialog import WarningDialog
|
||||
|
||||
_findint = re.compile('^[^\d]*(\d+)[^\d]*')
|
||||
@@ -46,14 +47,14 @@ _findint = re.compile('^[^\d]*(\d+)[^\d]*')
|
||||
def runTool(db,active_person,callback,parent):
|
||||
"""Changed person, family, object, source, and place ids"""
|
||||
#FIXME -- Remove when the tool is back from the dead
|
||||
WarningDialog(_('Tool currently unavailable'),
|
||||
_('This tool has not yet been brought up to date '
|
||||
'after transition to the database, sorry.'),parent.topWindow)
|
||||
return
|
||||
#WarningDialog(_('Tool currently unavailable'),
|
||||
# _('This tool has not yet been brought up to date '
|
||||
# 'after transition to the database, sorry.'),parent.topWindow)
|
||||
#return
|
||||
|
||||
#FIXME
|
||||
try:
|
||||
ReorderIds(db,callback)
|
||||
ReorderIds(db)
|
||||
except:
|
||||
import DisplayTrace
|
||||
DisplayTrace.DisplayTrace()
|
||||
@@ -65,31 +66,43 @@ def runTool(db,active_person,callback,parent):
|
||||
#-------------------------------------------------------------------------
|
||||
class ReorderIds:
|
||||
|
||||
def __init__(self,db,callback):
|
||||
def __init__(self,db):
|
||||
|
||||
self.db = db
|
||||
|
||||
self.reorder_person()
|
||||
self.reorder(db.get_family_handle_map(),db.fprefix,None)
|
||||
self.reorder(db.get_object_map(),db.oprefix,None)
|
||||
self.reorder(db.get_source_map(),db.sprefix,db.build_source_display)
|
||||
self.reorder(db.get_place_handle_map(),db.pprefix,db.build_place_display)
|
||||
callback(1)
|
||||
self.trans = db.transaction_begin()
|
||||
self.reorder(RelLib.Person, db.get_person_from_gramps_id, db.get_person_from_handle,
|
||||
db.find_next_person_gramps_id, db.get_person_cursor, db.commit_person,
|
||||
db.iprefix)
|
||||
self.reorder(RelLib.Family,db.get_family_from_gramps_id, db.get_family_from_handle,
|
||||
db.find_next_family_gramps_id, db.get_family_cursor, db.commit_family,
|
||||
db.fprefix)
|
||||
self.reorder(RelLib.MediaObject, db.get_object_from_gramps_id, db.get_object_from_handle,
|
||||
db.find_next_object_gramps_id, db.get_media_cursor, db.commit_media_object,
|
||||
db.oprefix)
|
||||
self.reorder(RelLib.Source, db.get_source_from_gramps_id, db.get_source_from_handle,
|
||||
db.find_next_source_gramps_id, db.get_source_cursor, db.commit_source,
|
||||
db.sprefix)
|
||||
self.reorder(RelLib.Place, db.get_place_from_gramps_id, db.get_place_from_handle,
|
||||
db.find_next_place_gramps_id, db.get_place_cursor, db.commit_place,
|
||||
db.pprefix)
|
||||
db.transaction_commit(self.trans,_("Reorder gramps IDs"))
|
||||
|
||||
def reorder_person(self):
|
||||
def reorder(self, class_type, find_from_id, find_from_handle, find_next_id, get_cursor, commit, prefix):
|
||||
dups = []
|
||||
newids = {}
|
||||
key_list = []
|
||||
|
||||
# search all ids in the map
|
||||
|
||||
cursor = self.db.get_person_cursor()
|
||||
cursor = get_cursor()
|
||||
data = cursor.first()
|
||||
while data:
|
||||
(handle,sdata) = data
|
||||
|
||||
gramps_id = sdata[1]
|
||||
|
||||
obj = class_type()
|
||||
obj.unserialize(sdata)
|
||||
gramps_id = obj.get_gramps_id()
|
||||
# attempt to extract integer, if we can't, treat it as a
|
||||
# duplicate
|
||||
|
||||
@@ -104,42 +117,27 @@ class ReorderIds:
|
||||
newgramps_id = prefix % int(index)
|
||||
if newgramps_id == gramps_id:
|
||||
newids[newgramps_id] = gramps_id
|
||||
continue
|
||||
elif data_map.has_key(newgramps_id):
|
||||
dups.append(handle)
|
||||
elif find_from_id(newgramps_id) != None:
|
||||
dups.append(obj.get_handle())
|
||||
else:
|
||||
data = data_map[gramps_id]
|
||||
data_map[newgramps_id] = data
|
||||
newids[newgramps_id] = gramps_id
|
||||
data.set_gramps_id(newgramps_id)
|
||||
del data_map[gramps_id]
|
||||
if update:
|
||||
update(newgramps_id,gramps_id)
|
||||
commit(obj,self.trans)
|
||||
newids[newgramps_id] = gramps_id
|
||||
except:
|
||||
dups.append(handle)
|
||||
else:
|
||||
dups.append(handle)
|
||||
|
||||
data = cursor.next()
|
||||
|
||||
cursor.close()
|
||||
|
||||
# go through the duplicates, looking for the first availble
|
||||
# handle that matches the new scheme.
|
||||
|
||||
index = 0
|
||||
for gramps_id in dups:
|
||||
while 1:
|
||||
newgramps_id = prefix % index
|
||||
if not newids.has_key(newgramps_id):
|
||||
break
|
||||
index = index + 1
|
||||
newids[newgramps_id] = newgramps_id
|
||||
data = data_map[gramps_id]
|
||||
data.set_gramps_id(newgramps_id)
|
||||
data_map[newgramps_id] = data
|
||||
if update:
|
||||
update(newgramps_id,gramps_id)
|
||||
del data_map[gramps_id]
|
||||
for handle in dups:
|
||||
obj = find_from_handle(handle)
|
||||
obj.set_gramps_id(find_next_id())
|
||||
commit(obj,self.trans)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -845,7 +845,7 @@ class ScratchPadWindow:
|
||||
|
||||
def on_help_clicked(self,obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
help_display('gramps-manual','tools-util')
|
||||
help_display('gramps-manual','tools-util-scratch-pad')
|
||||
|
||||
def on_close_scratchpad(self,obj):
|
||||
self.remove_itself_from_menu()
|
||||
|
||||
@@ -117,7 +117,7 @@ class SoundGen:
|
||||
|
||||
def on_help_clicked(self,obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
help_display('gramps-manual','tools-util')
|
||||
help_display('gramps-manual','tools-util-other')
|
||||
|
||||
def on_delete_event(self,obj,b):
|
||||
self.remove_itself_from_menu()
|
||||
|
||||
@@ -524,9 +524,9 @@ class StatisticsChart(Report.Report):
|
||||
# document heading
|
||||
mapping['chart_title'] = table[0]
|
||||
if genders:
|
||||
heading = "%(genders)s born %(year_from)04d-%(year_to)04d: %(chart_title)s" % mapping
|
||||
heading = _("%(genders)s born %(year_from)04d-%(year_to)04d: %(chart_title)s") % mapping
|
||||
else:
|
||||
heading = "Persons born %(year_from)04d-%(year_to)04d: %(chart_title)s" % mapping
|
||||
heading = _("Persons born %(year_from)04d-%(year_to)04d: %(chart_title)s") % mapping
|
||||
self.data.append((heading, table[1], lookup))
|
||||
#DEBUG
|
||||
#print heading
|
||||
@@ -899,7 +899,7 @@ class StatisticsChartOptions(ReportOptions.ReportOptions):
|
||||
tip = _("With fewer items pie chart and legend will be used instead of a bar chart.")
|
||||
self.bar_items = gtk.Entry(2)
|
||||
self.bar_items.set_text(str(self.options_dict['bar_items']))
|
||||
dialog.add_option("Min. bar char items", self.bar_items, tip)
|
||||
dialog.add_option(_("Min. bar char items"), self.bar_items, tip)
|
||||
|
||||
# -------------------------------------------------
|
||||
# List of available charts on a separate option tab
|
||||
@@ -919,12 +919,12 @@ class StatisticsChartOptions(ReportOptions.ReportOptions):
|
||||
vbox = gtk.VBox()
|
||||
hbox.add(vbox)
|
||||
tip = _("Mark checkboxes to add charts with indicated data")
|
||||
dialog.add_frame_option("Chart Selection", "", hbox, tip)
|
||||
dialog.add_frame_option(_("Chart Selection"), "", hbox, tip)
|
||||
hbox.show_all()
|
||||
|
||||
# Note about children
|
||||
label = gtk.Label(_("Note that both biological and adopted children are taken into account."))
|
||||
dialog.add_frame_option("Chart Selection", "", label)
|
||||
dialog.add_frame_option(_("Chart Selection"), "", label)
|
||||
|
||||
|
||||
def parse_user_options(self, dialog):
|
||||
@@ -958,5 +958,5 @@ register_report(
|
||||
status = (_("Alpha")),
|
||||
author_name="Eero Tamminen",
|
||||
author_email="",
|
||||
description= _("Generates statistical bar graphs.")
|
||||
description= _("Generates statistical bar and pie charts of the people in the database.")
|
||||
)
|
||||
|
||||
@@ -522,9 +522,9 @@ class TestcaseGenerator:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def TestcaseGeneratorPlugin(database,active_person,callback,parent=None):
|
||||
print "TestcaseGeneratorPlugin"
|
||||
fg = TestcaseGenerator(database,active_person,callback,parent)
|
||||
fg.run()
|
||||
if not database.readonly:
|
||||
fg = TestcaseGenerator(database,active_person,callback,parent)
|
||||
fg.run()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -109,7 +109,7 @@ class Verify:
|
||||
|
||||
def on_help_clicked(self,obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
help_display('gramps-manual','tools-util')
|
||||
help_display('gramps-manual','tools-util-other')
|
||||
|
||||
def get_year(self,event_handle):
|
||||
"""
|
||||
|
||||
@@ -66,26 +66,35 @@ _level_name_plural = [ "", "primeros", "segundos", "terceros", "cuartos",
|
||||
"decimoséptimos", "decimoctavos", "decimononos",
|
||||
"vigésimos", ]
|
||||
|
||||
# This plugin tries to be flexible and expect little from the following
|
||||
# tables. Ancestors are named from the list for the first generations.
|
||||
# When this list is not enough, ordinals are used based on the same idea,
|
||||
# i.e. bisabuelo is 'segundo abuelo' and so on, that has been the
|
||||
# traditional way in Spanish. When we run out of ordinals we resort to
|
||||
# N-ésimo notation, that is sort of understandable if in context.
|
||||
_parents_level = [ "", "padres", "abuelos", "bisabuelos", "tatarabuelos",
|
||||
"trastatarabuelos"]
|
||||
|
||||
_father_level = [ "", "padre", "abuelo", "bisabuelo", "tatarabuelo",
|
||||
"trastatarabuelo"]
|
||||
|
||||
_mother_level = [ "", "madre", "abuela", "bisabuela", "tatarabuela",
|
||||
"trastatarabuela"]
|
||||
|
||||
# Higher-order terms (after trastatarabuelo) on this list are not standard,
|
||||
# but then there is no standard naming scheme at all for this in Spanish.
|
||||
# Check http://www.genealogia-es.com/guia3.html that echoes a proposed
|
||||
# scheme that has got some reception in the Spanish-language genealogy
|
||||
# community. This plugin implements a scheme based on this list. When
|
||||
# this list is not enough, ordinals are used based on the same idea, i.e.
|
||||
# bisabuelo is 'segundo abuelo' and so on. When we run out of ordinals
|
||||
# we resort to N-ésimo notation, that is sort of understandable if in
|
||||
# context.
|
||||
_parents_level = [ "", "padres", "abuelos", "bisabuelos", "tatarabuelos",
|
||||
"trastatarabuelos", "pentabuelos", "hexabuelos",
|
||||
"heptabuelos", "octabuelos", "eneabuelos", "decabuelos"]
|
||||
|
||||
_father_level = [ "", "padre", "abuelo", "bisabuelo", "tatarabuelo",
|
||||
"trastatarabuelo", "pentabuelo", "hexabuelo",
|
||||
"heptabuelo", "octabuelo", "eneabuelo", "decabuelo"]
|
||||
|
||||
_mother_level = [ "", "madre", "abuela", "bisabuela", "tatarabuela",
|
||||
"trastatarabuela", "pentabuela", "hexabuela",
|
||||
"heptabuela", "octabuela", "eneabuela", "decabuela"]
|
||||
# community. Uncomment these names if you want to use them.
|
||||
#_parents_level = [ "", "padres", "abuelos", "bisabuelos", "tatarabuelos",
|
||||
# "trastatarabuelos", "pentabuelos", "hexabuelos",
|
||||
# "heptabuelos", "octabuelos", "eneabuelos", "decabuelos"]
|
||||
#_father_level = [ "", "padre", "abuelo", "bisabuelo", "tatarabuelo",
|
||||
# "trastatarabuelo", "pentabuelo", "hexabuelo",
|
||||
# "heptabuelo", "octabuelo", "eneabuelo", "decabuelo"]
|
||||
#_mother_level = [ "", "madre", "abuela", "bisabuela", "tatarabuela",
|
||||
# "trastatarabuela", "pentabuela", "hexabuela",
|
||||
# "heptabuela", "octabuela", "eneabuela", "decabuela"]
|
||||
|
||||
_son_level = [ "", "hijo", "nieto", "bisnieto",
|
||||
"tataranieto", "trastataranieto", ]
|
||||
|
||||
Reference in New Issue
Block a user