Fixed merging
svn: r3167
This commit is contained in:
		| @@ -68,7 +68,6 @@ class MergePeople: | ||||
|         self.altname = self.glade.get_widget("altname") | ||||
|         self.altbirth = self.glade.get_widget("altbirth") | ||||
|         self.altdeath = self.glade.get_widget("altdeath") | ||||
|         self.family_list = db.get_family_id_map().values() | ||||
|  | ||||
|         self.glade.signal_autoconnect({ | ||||
|             "on_merge_clicked" : self.on_merge_clicked, | ||||
| @@ -355,12 +354,13 @@ class MergePeople: | ||||
|     def find_family(self,family): | ||||
|         if self.p1.get_gender() == RelLib.Person.male: | ||||
|             mother = family.get_mother_id() | ||||
|             father = self.p1 | ||||
|             father = self.p1.get_id() | ||||
|         else: | ||||
|             father = family.get_father_id() | ||||
|             mother = self.p1 | ||||
|             mother = self.p1.get_id() | ||||
|  | ||||
|         for myfamily in self.family_list: | ||||
|         for myfamily_id in self.db.get_family_keys(): | ||||
|             myfamily = self.db.find_family_from_id(myfamily_id) | ||||
|             if myfamily.get_father_id() == father and myfamily.get_mother_id() == mother: | ||||
|                 return myfamily | ||||
|         return None | ||||
| @@ -389,7 +389,7 @@ class MergePeople: | ||||
|             # | ||||
|             if tgt_family in self.p1.get_family_id_list(): | ||||
|                 if tgt_family.get_father_id() != None and \ | ||||
|                    src_family in tgt_family.get_father_id().get_family_id_list(): | ||||
|                    src_family in tgt_father.get_family_id_list(): | ||||
|                     tgt_family.get_father_id().remove_family_id(src_family) | ||||
|                 if tgt_family.get_mother_id() != None and \ | ||||
|                    src_family in tgt_family.get_mother_id().get_family_id_list(): | ||||
|   | ||||
| @@ -2663,23 +2663,20 @@ class GrampsDB: | ||||
|         if len(self.translist) == 0: | ||||
|             return | ||||
|         transaction = self.translist.pop() | ||||
|         transaction.display() | ||||
|  | ||||
|         subitems = transaction.get_data() | ||||
|         subitems.reverse() | ||||
|         for (key, gid, data) in subitems: | ||||
|             if key == PERSON_KEY: | ||||
|                 if data == None: | ||||
|                     print "removing PERSON",gid | ||||
|                     del self.person_map[gid] | ||||
|                 else: | ||||
|                     print "altering PERSON",gid | ||||
|                     self.person_map.put(gid,data) | ||||
|             elif key == FAMILY_KEY: | ||||
|                 if data == None: | ||||
|                     print "removing FAMILY",gid | ||||
|                     del self.family_map[gid] | ||||
|                 else: | ||||
|                     print "altering FAMILY",gid | ||||
|                     self.family_map.put(gid,data) | ||||
|             elif key == SOURCE_KEY: | ||||
|                 if data == None: | ||||
| @@ -2688,10 +2685,8 @@ class GrampsDB: | ||||
|                     self.source_map.put(gid,data) | ||||
|             elif key == EVENT_KEY: | ||||
|                 if data == None: | ||||
|                     print "removing EVENT",gid | ||||
|                     del self.event_map[gid] | ||||
|                 else: | ||||
|                     print "altering EVENT",gid | ||||
|                     self.event_map.put(gid,data) | ||||
|             elif key == PLACE_KEY: | ||||
|                 if data == None: | ||||
|   | ||||
| @@ -355,6 +355,7 @@ class Gramps: | ||||
|             self.change_active_person(p) | ||||
|         self.place_view.change_db(self.db) | ||||
|         self.people_view.change_db(self.db) | ||||
|         self.people_view.apply_filter() | ||||
|         self.source_view.change_db(self.db) | ||||
|         self.media_view.change_db(self.db) | ||||
|         self.family_view.load_family() | ||||
|   | ||||
| @@ -70,9 +70,6 @@ def runTool(database,active_person,callback,parent=None): | ||||
|         if errs: | ||||
|             checker.report(0) | ||||
|     except: | ||||
|         database.add_transaction(trans) | ||||
|         database.undo() | ||||
|  | ||||
|         import DisplayTrace | ||||
|         DisplayTrace.DisplayTrace() | ||||
|  | ||||
|   | ||||
| @@ -48,7 +48,6 @@ import os | ||||
| # GNOME libraries | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| from gnome.ui import * | ||||
| import gtk  | ||||
| import gtk.glade | ||||
|  | ||||
|   | ||||
| @@ -54,7 +54,7 @@ from gettext import gettext as _ | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| _title_re = re.compile(r"^([A-Za-z][A-Za-z]+\.)\s+(.*)$") | ||||
| _nick_re = re.compile(r"(.+)[(\"](.*)[)\"]") | ||||
| _nick_re = re.compile(r"(.+)\s*[(\"](.*)[)\"]") | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| @@ -65,12 +65,8 @@ _nick_re = re.compile(r"(.+)[(\"](.*)[)\"]") | ||||
| #------------------------------------------------------------------------- | ||||
| def runTool(database,active_person,callback,parent=None): | ||||
|     try: | ||||
|         trans = database.start_transaction() | ||||
|         PatchNames(database,callback,parent,trans) | ||||
|         database.add_transaction(trans) | ||||
|         PatchNames(database,callback,parent) | ||||
|     except: | ||||
|         database.add_transaction(trans) | ||||
|         database.undo() | ||||
|         import DisplayTrace | ||||
|         DisplayTrace.DisplayTrace() | ||||
|  | ||||
| @@ -81,11 +77,11 @@ def runTool(database,active_person,callback,parent=None): | ||||
| #------------------------------------------------------------------------- | ||||
| class PatchNames: | ||||
|  | ||||
|     def __init__(self,db,callback,parent,trans): | ||||
|     def __init__(self,db,callback,parent): | ||||
|         self.cb = callback | ||||
|         self.db = db | ||||
|         self.parent = parent | ||||
|         self.trans = trans | ||||
|         self.trans = db.start_transaction() | ||||
|         self.win_key = self | ||||
|         self.child_windows = {} | ||||
|         self.title_list = [] | ||||
| @@ -111,7 +107,6 @@ class PatchNames: | ||||
|         else: | ||||
|             OkDialog(_('No modifications made'), | ||||
|                      _("No titles or nicknames were found")) | ||||
|             self.cb(0) | ||||
|  | ||||
|     def toggled(self,cell,path_string): | ||||
|         path = tuple([int (i) for i in path_string.split(':')]) | ||||
| @@ -212,8 +207,8 @@ class PatchNames: | ||||
|             if val: | ||||
|                 p = self.db.get_person(grp[0]) | ||||
|                 name = p.get_primary_name() | ||||
|                 name.set_first_name(grp[1]) | ||||
|                 p.set_nick_name(grp[2]) | ||||
|                 name.set_first_name(grp[1].strip()) | ||||
|                 p.set_nick_name(grp[2].strip()) | ||||
|                 self.db.commit_person(p,self.trans) | ||||
|  | ||||
|         for grp in self.title_list: | ||||
| @@ -222,10 +217,11 @@ class PatchNames: | ||||
|             if val: | ||||
|                 p = self.db.find_person_from_id(grp[0]) | ||||
|                 name = p.get_primary_name() | ||||
|                 name.set_first_name(grp[2]) | ||||
|                 name.set_title(grp[1]) | ||||
|                 name.set_first_name(grp[2].strip()) | ||||
|                 name.set_title(grp[1].strip()) | ||||
|                 self.db.commit_person(p,self.trans) | ||||
|  | ||||
|         self.db.add_transaction(self.trans) | ||||
|         self.close(obj) | ||||
|         self.cb(1) | ||||
|          | ||||
| @@ -240,5 +236,7 @@ register_tool( | ||||
|     runTool, | ||||
|     _("Extract information from names"), | ||||
|     category=_("Database Processing"), | ||||
|     description=_("Searches the entire database and attempts to extract titles and nicknames that may be embedded in a person's given name field.") | ||||
|     description=_("Searches the entire database and attempts to " | ||||
|                   "extract titles and nicknames that may be embedded " | ||||
|                   "in a person's given name field.") | ||||
|     ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user