diff --git a/NEWS b/NEWS index 221db2671..f0cc7cf22 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,8 @@ Version 0.6.0pre format statements (such as "I-%04d"). * Adoption relationships are visible on the pedigree view (seen as a dotted line). +* Reordering GRAMPS' ids attempts to preserve the integer originally + assigned to the object. Version 0.5.1 * Bug fixes diff --git a/src/const.py b/src/const.py index 4196be4cd..bde8f5fce 100644 --- a/src/const.py +++ b/src/const.py @@ -53,7 +53,8 @@ if os.environ.has_key('GRAMPSDIR'): else: rootDir = "." -logo = rootDir + os.sep + "gramps.xpm" +icon = rootDir + os.sep + "gramps.xpm" +logo = rootDir + os.sep + "logo.png" gladeFile = rootDir + os.sep + "gramps.glade" placesFile = rootDir + os.sep + "places.glade" imageselFile = rootDir + os.sep + "imagesel.glade" @@ -78,16 +79,9 @@ gtkrcFile = rootDir + os.sep + "gtkrc" #------------------------------------------------------------------------- progName = "gramps" version = "0.6.0pre" -copyright = "(C) 2001 Donald N. Allingham" -authors = ["Donald N. Allingham"] -comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program that can be extended by using the Python programming language.") - -#------------------------------------------------------------------------- -# -# Enable/disable exceptions. For debugging purposes -# -#------------------------------------------------------------------------- -useExceptions= 0 +copyright = "© 2001 Donald N. Allingham" +authors = ["Donald N. Allingham", "David Hampton"] +comments = _("Gramps (Genealogical Research and Analysis Management Programming System) is a personal genealogy program.") #------------------------------------------------------------------------- # diff --git a/src/gramps_main.py b/src/gramps_main.py index ac45cdf53..74ae32cc2 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -2659,7 +2659,7 @@ def main(arg): fw.set_sensitive(0) # set the window icon - topWindow.set_icon(GtkPixmap(topWindow,const.logo)) + topWindow.set_icon(GtkPixmap(topWindow,const.icon)) person_list.column_titles_active() diff --git a/src/logo.png b/src/logo.png new file mode 100644 index 000000000..29902d3f1 Binary files /dev/null and b/src/logo.png differ diff --git a/src/plugins/ReorderIds.py b/src/plugins/ReorderIds.py index 671c41fbf..1bd01df1f 100644 --- a/src/plugins/ReorderIds.py +++ b/src/plugins/ReorderIds.py @@ -20,11 +20,14 @@ "Database Processing/Reorder gramps IDs" +import re import utils import intl _ = intl.gettext +_findint = re.compile('^[^\d]*(\d+)[^\d]*') + #------------------------------------------------------------------------- # # @@ -32,64 +35,46 @@ _ = intl.gettext #------------------------------------------------------------------------- def runTool(database,active_person,callback): - for prefix in ["xyzzytemporaryid%d", database.iprefix] : - 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", database.fprefix] : - 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", database.sprefix] : - 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 - - for prefix in ["xyzzytemporaryid%d", database.pprefix] : - index = 0 - pmap = database.getPlaceMap() - 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", database.oprefix] : - index = 0 - pmap = database.getObjectMap() - for id in pmap.keys(): - newid = prefix % index - person = pmap[id] - person.setId(newid) - pmap[newid] = person - del pmap[id] - index = index + 1 - + make_new_ids(database.getPersonMap(),database.iprefix) + make_new_ids(database.getFamilyMap(),database.fprefix) + make_new_ids(database.getObjectMap(),database.oprefix) + make_new_ids(database.getSourceMap(),database.sprefix) + make_new_ids(database.getPlaceMap(),database.pprefix) utils.modified() callback(1) + +def make_new_ids(data_map,prefix): + dups = [] + newids = [] + for id in data_map.keys(): + match = _findint.match(id) + if match: + index = match.groups()[0] + newid = prefix % int(index) + if newid == id: + continue + elif data_map.has_key(newid): + dups.append(id) + else: + newids.append(id) + data = data_map[id] + data.setId(newid) + data_map[newid] = data + del data_map[id] + index = 0 + for id in dups: + while 1: + newid = prefix % index + if newid not in newids: + break + index = index + 1 + newids.append(newid) + data = data_map[id] + data.setId(newid) + data_map[newid] = data + del data_map[id] + #------------------------------------------------------------------------- # #