diff --git a/gramps2/example/gramps/data.gramps b/gramps2/example/gramps/data.gramps index f62de5b73..68bcdbdae 100644 Binary files a/gramps2/example/gramps/data.gramps and b/gramps2/example/gramps/data.gramps differ diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index 588fcaa51..c37062649 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -1426,7 +1426,6 @@ def disp_url(url): # #------------------------------------------------------------------------- def disp_attr(attr): - detail = Utils.get_detail_flags(attr) return [const.display_pattr(attr.getType()),attr.getValue()] #------------------------------------------------------------------------- @@ -1444,7 +1443,6 @@ def disp_addr(addr): # #------------------------------------------------------------------------- def disp_event(event): - attr = Utils.get_detail_flags(event) return [const.display_pevent(event.getName()),event.getDescription(), event.getQuoteDate(),event.getPlaceName()] diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index b629126c9..539287a5c 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -62,6 +62,7 @@ from intl import gettext as _ _IMAGEX = 140 _IMAGEY = 150 +_PAD = 5 #------------------------------------------------------------------------- # @@ -77,9 +78,12 @@ class ImageSelect: self.path = path; self.db = db self.dataobj = None - self.parent = parent - self.canvas_list = [] - + self.parent = parent + self.canvas_list = {} + self.item_map = {} + self.item_map = {} + self.p_map = {} + def add_thumbnail(self, photo): "should be overrridden" pass @@ -189,6 +193,13 @@ class ImageSelect: """Save the photo in the dataobj object - must be overridden""" pass +_drag_targets = [ + ('STRING', 0, 0), + ('text/plain',0,0), + ('text/uri-list',0,2), + ('application/x-rootwin-drop',0,1)] + + #------------------------------------------------------------------------- # # Gallery class - This class handles all the logic underlying a @@ -200,22 +211,15 @@ class Gallery(ImageSelect): def __init__(self, dataobj, path, icon_list, db, parent): ImageSelect.__init__(self, path, db, parent) - t = [ - ('STRING', 0, 0), - ('text/plain',0,0), - ('text/uri-list',0,2), - ('application/x-rootwin-drop',0,1)] - if path: - icon_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, t, + icon_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, _drag_targets, gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE) + icon_list.connect('event',self.item_event) icon_list.connect("drag_data_received", self.on_photolist_drag_data_received) - icon_list.drag_source_set(gtk.gdk.BUTTON1_MASK|gtk.gdk.BUTTON3_MASK,t, - gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE) icon_list.connect("drag_data_get", self.on_photolist_drag_data_get) - + # Remember arguments self.path = path; self.dataobj = dataobj; @@ -226,24 +230,60 @@ class Gallery(ImageSelect): self.selectedIcon = -1 self.x = 0 self.y = 0 + self.remember_x = -1 + self.remember_y = -1 + self.button = None + self.drag_item = None + self.sel = None + self.photo = None + + def on_canvas1_event(self,obj,event): + """Handle resize events over the canvas, redrawing if the size changes""" def item_event(self, widget, event=None): + if self.button and event.type == gtk.gdk.MOTION_NOTIFY : + if widget.drag_check_threshold(self.remember_x,self.remember_y,event.x,event.y): + self.drag_item = widget.get_item_at(self.remember_x,self.remember_y) + if self.drag_item: + context = widget.drag_begin(_drag_targets, + gtk.gdk.ACTION_COPY|gtk.gdk.ACTION_MOVE, + self.button, event) + return gtk.TRUE photo = widget.get_data('obj') + if event.type == gtk.gdk.BUTTON_PRESS: if event.button == 1: # Remember starting position. + + item = widget.get_item_at(event.x,event.y) + if item: + (i,t,b,self.photo) = self.p_map[item] + style = self.iconlist.get_style() + t.set(fill_color_gdk=style.fg[gtk.STATE_SELECTED]) + b.set(fill_color_gdk=style.bg[gtk.STATE_SELECTED]) + if self.sel: + (i,t,b,photo) = self.p_map[self.sel] + t.set(fill_color_gdk=style.fg[gtk.STATE_NORMAL]) + b.set(fill_color_gdk=style.bg[gtk.STATE_NORMAL]) + + self.sel = item + self.remember_x = event.x self.remember_y = event.y + self.button = event.button return gtk.TRUE elif event.button == 3: - self.show_popup(photo) + item = widget.get_item_at(event.x,event.y) + if item: + (i,t,b,self.photo) = self.p_map[item] + self.show_popup(self.photo) return gtk.TRUE - + elif event.type == gtk.gdk.BUTTON_RELEASE: + self.button = 0 elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: #Change the item's color. - print photo,self.path,self LocalMediaProperties(photo,self.path,self) return gtk.TRUE @@ -258,13 +298,8 @@ class Gallery(ImageSelect): return gtk.TRUE - elif event.type == gtk.gdk.ENTER_NOTIFY: - # Make the outline wide. - return gtk.TRUE - - elif event.type == gtk.gdk.LEAVE_NOTIFY: - # Make the outline thin. - return gtk.TRUE + if event.type == gtk.gdk.EXPOSE: + self.load_images() return gtk.FALSE @@ -279,58 +314,79 @@ class Gallery(ImageSelect): def add_thumbnail(self, photo): """Scale the image and add it to the IconList.""" object = photo.getReference() - name = Utils.thumb_path(self.db.getSavePath(),object) - description = object.getDescription() - if len(description) > 20: - description = "%s..." % description[0:20] - - image = gtk.gdk.pixbuf_new_from_file(name) - x = image.get_width() - y = image.get_height() - - grp = self.root.add(gnome.canvas.CanvasGroup,x=self.cx,y=self.cy) - grp.connect('event',self.item_event) - grp.set_data('obj',photo) - - xloc = (_IMAGEX-x)/2 - yloc = (_IMAGEX-y)/2 - - item = grp.add(gnome.canvas.CanvasPixbuf, - pixbuf=image, - x=xloc, - y=yloc) - text = grp.add(gnome.canvas.CanvasText, - x=_IMAGEX/2, - y=_IMAGEX, - anchor=gtk.ANCHOR_CENTER, - text=description) + oid = object.getId() - self.cx = 10 + _IMAGEX + self.cx - if self.cx + 10 + _IMAGEX > self.x: - self.cx = 10 - self.cy = self.cy + 10 + _IMAGEY + if self.canvas_list.has_key(oid): + (grp,item,text,bg,x,y) = self.canvas_list[oid] + if x != self.cx or y != self.cy: + grp.move(self.cx-x,self.cy-y) + else: + name = Utils.thumb_path(self.db.getSavePath(),object) + description = object.getDescription() + if len(description) > 20: + description = "%s..." % description[0:20] + + image = gtk.gdk.pixbuf_new_from_file(name) + x = image.get_width() + y = image.get_height() + + grp = self.root.add(gnome.canvas.CanvasGroup,x=self.cx,y=self.cy) + + xloc = (_IMAGEX-x)/2 + yloc = (_IMAGEY-y)/2 + + bg = grp.add(gnome.canvas.CanvasRect, + x1=0, + x2=_IMAGEX, + y2=_IMAGEY, + y1=_IMAGEY-20) + + item = grp.add(gnome.canvas.CanvasPixbuf, + pixbuf=image, + x=xloc, + y=yloc) + + text = grp.add(gnome.canvas.CanvasText, + x=_IMAGEX/2, + y=_IMAGEX, + anchor=gtk.ANCHOR_CENTER, + text=description) + + + self.item_map[item] = oid + self.item_map[text] = oid + self.item_map[grp] = oid + self.item_map[bg] = oid + + self.p_map[item] = (item,text,bg,photo) + self.p_map[text] = (item,text,bg,photo) + self.p_map[grp] = (item,text,bg,photo) + self.p_map[bg] = (item,text,bg,photo) - item.show() - text.show() - self.canvas_list.append(grp) - self.canvas_list.append(item) - self.canvas_list.append(text) + item.show() + text.show() + bg.show() + + self.canvas_list[oid] = (grp,item,text,bg,self.cx,self.cy) + + if self.cx + _PAD + _IMAGEX > self.x: + self.cx = _PAD + self.cy = self.cy + _PAD + _IMAGEY + else: + self.cx = _PAD + self.cx + _IMAGEX def load_images(self): """clears the currentImages list to free up any cached Imlibs. Then add each photo in the place's list of photos to the photolist window.""" - for item in self.canvas_list: - item.destroy() - self.pos = 0 - self.cx = 10 - self.cy = 10 + self.cx = _PAD + self.cy = _PAD (self.x,self.y) = self.iconlist.get_size() - self.max = (self.x)/(_IMAGEX+10) + self.max = (self.x)/(_IMAGEX+_PAD) for photo in self.dataobj.getPhotoList(): self.add_thumbnail(photo) @@ -345,13 +401,12 @@ class Gallery(ImageSelect): self.selectedIcon = iconNumber def get_index(self,obj,x,y): - x_offset = x/(_IMAGEX+10) - y_offset = y/(_IMAGEY+10) - index = (y_offset*self.max)+x_offset + x_offset = x/(_IMAGEX+_PAD) + y_offset = y/(_IMAGEY+_PAD) + index = (y_offset*(1+self.max))+x_offset return min(index,len(self.dataobj.getPhotoList())) def on_photolist_drag_data_received(self,w, context, x, y, data, info, time): - print "receive",w if data and data.format == 8: icon_index = self.get_index(w,x,y) d = string.strip(string.replace(data.data,'\0',' ')) @@ -441,20 +496,14 @@ class Gallery(ImageSelect): if GrampsCfg.globalprop: LocalMediaProperties(oref,self.path,self) Utils.modified() - #w.drag_finish(context, 1, 0, time) - else: - pass - #w.drag_finish(context, 0, 0, time) def on_photolist_drag_data_get(self,w, context, selection_data, info, time): - print "drag data get",w if info == 1: return - if self.selectedIcon != -1: - ref = self.dataobj.getPhotoList()[self.selectedIcon] - id = ref.getReference().getId() - selection_data.set(selection_data.target, 8, id) - + id = self.item_map[self.drag_item] + selection_data.set(selection_data.target, 8, id) + self.drag_item = None + def on_add_photo_clicked(self, obj): """User wants to add a new photo. Create a dialog to find out which photo they want.""" @@ -479,7 +528,6 @@ class Gallery(ImageSelect): def show_popup(self, photo): """Look for right-clicks on a picture and create a popup menu of the available actions.""" - menu = gtk.Menu() item = gtk.TearoffMenuItem() diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index a606b4332..20d70cca9 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -25,29 +25,7 @@ class ListModel: def __init__(self,tree,dlist): self.tree = tree l = len(dlist) - if l == 1: - self.model = gtk.ListStore(TYPE_STRING) - elif l == 2: - self.model = gtk.ListStore(TYPE_STRING, TYPE_STRING) - elif l == 3: - self.model = gtk.ListStore(TYPE_STRING, TYPE_STRING, TYPE_STRING) - elif l == 4: - self.model = gtk.ListStore(TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_STRING) - elif l == 5: - self.model = gtk.ListStore(TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_STRING, TYPE_STRING) - elif l == 6: - self.model = gtk.ListStore(TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_STRING, TYPE_STRING, TYPE_STRING) - elif l == 7: - self.model = gtk.ListStore(TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_STRING) - elif l == 8: - self.model = gtk.ListStore(TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_STRING, TYPE_STRING, TYPE_STRING, - TYPE_STRING, TYPE_STRING) + self.model = gtk.ListStore(*[TYPE_STRING]*l) self.selection = self.tree.get_selection() self.tree.set_model(self.model) diff --git a/gramps2/src/SelectChild.py b/gramps2/src/SelectChild.py index a32108f18..057a0634e 100644 --- a/gramps2/src/SelectChild.py +++ b/gramps2/src/SelectChild.py @@ -121,21 +121,21 @@ class SelectChild: bday = self.person.getBirth().getDateObj() dday = self.person.getDeath().getDateObj() - slist = [] + slist = {} for f in self.person.getParentList(): if f: if f[0].getFather(): - slist.append(f[0].getFather()) + slist[f[0].getFather().getId()] = 1 elif f[0].getMother(): - slist.append(f[0].getMother()) + slist[f[0].getMother().getId()] = 1 for c in f[0].getChildList(): - slist.append(c) + slist[c.getId()] = 1 person_list = [] for key in self.db.getPersonKeys(): person = self.db.getPerson(key) if filter: - if person in slist or person.getMainParents(): + if slist.has_key(key) or person.getMainParents(): continue pdday = person.getDeath().getDateObj() @@ -167,10 +167,10 @@ class SelectChild: if pdday.getLowYear() > dday.getHighYear() + 150: continue - person_list.append(person) + person_list.append(person.getId()) - for person in person_list: - dinfo = self.db.getPersonDisplay(id) + for idval in person_list: + dinfo = self.db.getPersonDisplay(idval) rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]] self.refmodel.add(rdata) diff --git a/gramps2/src/edit_person.glade b/gramps2/src/edit_person.glade index 9b616c739..613d4e96a 100644 --- a/gramps2/src/edit_person.glade +++ b/gramps2/src/edit_person.glade @@ -4274,8 +4274,8 @@ True True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC GTK_SHADOW_NONE GTK_CORNER_TOP_LEFT diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index e15ee8fa7..ea60c3cb1 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -5450,6 +5450,7 @@ GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False + 300 True False True diff --git a/gramps2/src/mergedata.glade b/gramps2/src/mergedata.glade index 31c3d6198..8d7831c7f 100644 --- a/gramps2/src/mergedata.glade +++ b/gramps2/src/mergedata.glade @@ -1,1945 +1,1756 @@ - - + + - - merge - merge - - src - pixmaps - C - True - True - + + + Merge Places - GRAMPS + GTK_WINDOW_TOPLEVEL + yes + no + yes + 400 + yes + GTK_WIN_POS_NONE - - GnomeDialog - merge_places - 400 - Merge Places - GRAMPS - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - True - False - False - False + + + no + 8 + yes - - GtkVBox - GnomeDialog:vbox - dialog-vbox2 - False - 8 - - 4 - True - True + + + GTK_BUTTONBOX_END + 8 + 400 + yes + + + + yes + yes + yes + gtk-ok + yes + yes + + + + + + + + yes + yes + yes + gtk-cancel + yes + yes + + + + + + + 0 + no + yes + GTK_PACK_END + + + + + + no + 0 + yes + + + + Select the title for the merged place + GTK_JUSTIFY_CENTER + no + 0.5 + 0.5 + 0 + 0 + yes + + + 0 + no + no + + + + + + yes + + + 10 + no + yes + + + + + + no + 0 + 0 + 3 + 2 + yes + + + + yes + yes + + 0 + yes + yes + + + 1 + 2 + 2 + 3 + 0 + 0 + expand|fill + + + + + + + + GTK_JUSTIFY_CENTER + no + 0 + 0.5 + 0 + 0 + yes + + + 1 + 2 + 0 + 1 + 0 + 0 + fill + + + + + + + + GTK_JUSTIFY_CENTER + no + 0 + 0.5 + 0 + 0 + yes + + + 1 + 2 + 1 + 2 + 0 + 0 + fill + + + + + + + yes + Place 1 + yes + yes + yes + + + 0 + 1 + 0 + 1 + 5 + 5 + fill + + + + + + + yes + Place 2 + no + yes + yes + title1 + + + 0 + 1 + 1 + 2 + 5 + 5 + fill + + + + + + + yes + Other + no + yes + yes + title1 + + + 0 + 1 + 2 + 3 + 5 + 5 + fill + + + + + + 0 + yes + yes + + + + + 0 + yes + yes + + + + + 4 + yes + yes + - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area2 - 400 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button7 - True - True - - clicked - on_merge_places_clicked - merge_places - Tue, 23 Oct 2001 23:26:52 GMT - - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button9 - True - True - - clicked - destroy_passed_object - merge_places - Tue, 23 Oct 2001 23:00:28 GMT - - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkVBox - vbox2 - False - 0 - - 0 - True - True - - - - GtkLabel - label56 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkHSeparator - hseparator6 - - 10 - False - True - - - - - GtkTable - table5 - 3 - 2 - False - 0 - 0 - - 0 - True - True - - - - GtkEntry - title3_text - True - True - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - title1_text - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - title2_text - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkRadioButton - title1 - True - - True - True - title - - 0 - 1 - 0 - 1 - 5 - 5 - False - False - False - False - True - False - - - - - GtkRadioButton - title2 - True - - False - True - title - - 0 - 1 - 1 - 2 - 5 - 5 - False - False - False - False - True - False - - - - - GtkRadioButton - title3 - True - - False - True - title - - 0 - 1 - 2 - 3 - 5 - 5 - False - False - False - False - True - False - - - - - + + Merge People - GRAMPS + GTK_WINDOW_TOPLEVEL + yes + no + yes + yes + GTK_WIN_POS_NONE - - GnomeDialog - merge - Merge People - GRAMPS - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - False - True - False - False - False + + + no + 8 + yes - - GtkVBox - GnomeDialog:vbox - dialog-vbox3 - False - 8 - - 4 - True - True + + + GTK_BUTTONBOX_END + 8 + yes + + + + yes + yes + Merge and Close + yes + + + + + + + + yes + yes + Merge and Edit + yes + + + + + + + + yes + yes + yes + gtk-cancel + yes + yes + + + + + + + 0 + no + yes + GTK_PACK_END + + + + + + no + 0 + 620 + yes + + + + Merge People + GTK_JUSTIFY_CENTER + no + 0.5 + 0.5 + 0 + 0 + yes + + + 10 + no + no + + + + + + yes + 0 + yes + + + + First Person + 0 + 300 + GTK_SHADOW_ETCHED_IN + yes + + + + no + 0 + 2 + 14 + 3 + yes + + + + yes + + no + yes + yes + + + 2 + 3 + 0 + 1 + 0 + 0 + shrink + + + + + + + Birth Date + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 4 + 5 + 0 + 0 + fill + + + + + + + Death Date + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 7 + 8 + 0 + 0 + fill + + + + + + + Mother + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 11 + 12 + 0 + 0 + fill + + + + + + + Name + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 0 + 1 + 0 + 0 + fill + + + + + + + Birth Place + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 5 + 6 + 0 + 0 + fill + + + + + + + Death Place + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 8 + 9 + 0 + 0 + fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 4 + 5 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 5 + 6 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 7 + 8 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 8 + 9 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 10 + 11 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 11 + 12 + 0 + 0 + expand|fill + + + + + + + Father + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 10 + 11 + 0 + 0 + fill + + + + + + + yes + + + 0 + 3 + 9 + 10 + 0 + 5 + fill + fill + + + + + + yes + + + 0 + 3 + 12 + 13 + 0 + 5 + fill + fill + + + + + + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + yes + + + + yes + no + yes + + + + CList:title + + GTK_JUSTIFY_CENTER + no + 0.5 + 0.5 + 0 + 0 + yes + + + + + + + + GTK_UPDATE_CONTINUOUS + yes + + + + + + GTK_UPDATE_CONTINUOUS + yes + + + + + 1 + 3 + 13 + 14 + 0 + 0 + fill + fill + + + + + + Spouses + GTK_JUSTIFY_CENTER + no + 1 + 0 + 5 + 0 + yes + + + 0 + 1 + 13 + 14 + 0 + 0 + fill + expand|fill + + + + + + yes + + + 0 + 3 + 6 + 7 + 0 + 0 + fill + expand|fill + + + + + + yes + + + 0 + 3 + 3 + 4 + 0 + 0 + fill + expand|fill + + + + + + yes + + no + yes + yes + + + 2 + 3 + 10 + 12 + 0 + 0 + shrink + + + + + + + yes + + yes + yes + yes + + + 2 + 3 + 7 + 9 + 0 + 0 + shrink + shrink + + + + + + yes + + no + yes + yes + + + 2 + 3 + 4 + 6 + 0 + 0 + shrink + shrink + + + + + + ID + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 2 + 3 + 0 + 0 + fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 2 + 3 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 0 + 1 + 0 + 0 + expand|fill + + + + + + + yes + + no + yes + yes + + + 2 + 3 + 2 + 3 + 0 + 0 + fill + + + + + + + yes + + + 0 + 3 + 1 + 2 + 0 + 0 + fill + expand|fill + + + + + + + 2 + yes + yes + + + + + + Second Person + 0 + 300 + GTK_SHADOW_ETCHED_IN + yes + + + + no + 0 + 2 + 14 + 3 + yes + + + + Death Date + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 7 + 8 + 0 + 0 + fill + + + + + + + Mother + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 11 + 12 + 0 + 0 + fill + + + + + + + Birth Place + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 5 + 6 + 0 + 0 + fill + + + + + + + Birth Date + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 4 + 5 + 0 + 0 + fill + + + + + + + Death Place + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 8 + 9 + 0 + 0 + fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 0 + 1 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 4 + 5 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 5 + 6 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 7 + 8 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 8 + 9 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 10 + 11 + 0 + 0 + expand|fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 11 + 12 + 0 + 0 + expand|fill + + + + + + + Spouses + GTK_JUSTIFY_CENTER + no + 1 + 0 + 5 + 0 + yes + + + 0 + 1 + 13 + 14 + 0 + 0 + fill + expand|fill + + + + + + Father + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 10 + 11 + 0 + 0 + fill + + + + + + + yes + + + 0 + 3 + 9 + 10 + 0 + 5 + fill + fill + + + + + + yes + + + 0 + 3 + 12 + 13 + 0 + 5 + fill + fill + + + + + + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + yes + + + + yes + no + yes + + + + CList:title + + GTK_JUSTIFY_CENTER + no + 0.5 + 0.5 + 0 + 0 + yes + + + + + + + + GTK_UPDATE_CONTINUOUS + yes + + + + + + GTK_UPDATE_CONTINUOUS + yes + + + + + 1 + 3 + 13 + 14 + 0 + 0 + fill + fill + + + + + + yes + + + 0 + 3 + 3 + 4 + 0 + 0 + fill + expand|fill + + + + + + yes + + + 0 + 3 + 6 + 7 + 0 + 0 + fill + expand|fill + + + + + + yes + + no + yes + yes + bbirth1 + + + 2 + 3 + 4 + 6 + 0 + 0 + shrink + + + + + + + yes + + no + yes + yes + death1 + + + 2 + 3 + 7 + 9 + 0 + 0 + shrink + + + + + + + yes + + no + yes + yes + bfather1 + + + 2 + 3 + 10 + 12 + 0 + 0 + shrink + + + + + + + Name + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 0 + 1 + 0 + 0 + fill + + + + + + + ID + GTK_JUSTIFY_CENTER + no + 1 + 0.5 + 5 + 0 + yes + + + 0 + 1 + 2 + 3 + 0 + 0 + fill + + + + + + + yes + no + + 0 + yes + yes + + + 1 + 2 + 2 + 3 + 0 + 0 + expand|fill + + + + + + + yes + + no + yes + yes + bname1 + + + 2 + 3 + 0 + 1 + 0 + 0 + shrink + + + + + + + yes + + no + yes + yes + id1 + + + 2 + 3 + 2 + 3 + 0 + 0 + fill + + + + + + + yes + + + 0 + 3 + 1 + 2 + 0 + 0 + fill + expand|fill + + + + + + + 2 + yes + yes + + + + + 0 + yes + yes + + + + + + no + 0 + yes + + + + + GTK_JUSTIFY_CENTER + no + 0.5 + 0.5 + 0 + 0 + yes + + + 0 + yes + yes + + + + + + no + 0 + yes + + + + yes + Keep other name as an alternate name + no + yes + yes + + + 0 + no + no + + + + + + yes + Keep other birth event as an alternate birth event + no + yes + yes + + + 0 + no + no + + + + + + yes + Keep other death event as an alternate death event + no + yes + yes + + + 0 + no + no + + + + + 0 + no + no + + + + + + + GTK_JUSTIFY_CENTER + no + 0.5 + 0.5 + 0 + 0 + yes + + + 0 + yes + yes + + + + + 3 + no + yes + + + + + 0 + yes + yes + + + + + 4 + yes + yes + - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area3 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button12 - True - True - - clicked - on_merge_clicked - merge - Thu, 25 Oct 2001 17:00:40 GMT - - - - - - GtkButton - button13 - True - True - - clicked - on_next_clicked - merge - Thu, 25 Oct 2001 17:00:18 GMT - - - - - - GtkButton - button14 - True - True - - clicked - destroy_passed_object - merge - Thu, 25 Oct 2001 16:59:59 GMT - - GNOME_STOCK_BUTTON_CANCEL - - - - - GtkVBox - vbox1 - 620 - False - 0 - - 0 - True - True - - - - GtkLabel - progress - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 10 - False - False - - - - - GtkHBox - hbox1 - True - 0 - - 0 - True - True - - - - GtkFrame - PersonFrame1 - 300 - - 0 - GTK_SHADOW_ETCHED_IN - - 2 - True - True - - - - GtkTable - table3 - 14 - 3 - False - 0 - 2 - - - GtkRadioButton - bname1 - True - - False - True - name - - 2 - 3 - 0 - 1 - 0 - 0 - False - False - True - False - False - False - - - - - GtkLabel - label8 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label12 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 7 - 8 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label22 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 11 - 12 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label4 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label26 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 5 - 6 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label30 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 8 - 9 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - birth1_text - True - False - True - 0 - - - 1 - 2 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - bplace1_text - True - False - True - 0 - - - 1 - 2 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - death1_text - True - False - True - 0 - - - 1 - 2 - 7 - 8 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - dplace1_text - True - False - True - 0 - - - 1 - 2 - 8 - 9 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - father1 - True - False - True - 0 - - - 1 - 2 - 10 - 11 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - mother1 - True - False - True - 0 - - - 1 - 2 - 11 - 12 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label16 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 10 - 11 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHSeparator - hseparator2 - - 0 - 3 - 9 - 10 - 0 - 5 - False - False - False - False - True - True - - - - - GtkHSeparator - hseparator4 - - 0 - 3 - 12 - 13 - 0 - 5 - False - False - False - False - True - True - - - - - GtkScrolledWindow - scrolledwindow1 - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 3 - 13 - 14 - 0 - 0 - False - False - False - False - True - True - - - - GtkCList - spouse1 - True - 1 - 80 - GTK_SELECTION_SINGLE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label51 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GtkLabel - label33 - - GTK_JUSTIFY_CENTER - False - 1 - 0 - 5 - 0 - - 0 - 1 - 13 - 14 - 0 - 0 - False - True - False - False - True - True - - - - - GtkHSeparator - hseparator7 - - 0 - 3 - 6 - 7 - 0 - 0 - False - True - False - False - True - True - - - - - GtkHSeparator - hseparator8 - - 0 - 3 - 3 - 4 - 0 - 0 - False - True - False - False - True - True - - - - - GtkRadioButton - bfather1 - True - - False - True - father - - 2 - 3 - 10 - 12 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - death1 - True - - True - True - death - - 2 - 3 - 7 - 9 - 0 - 0 - False - False - True - True - False - False - - - - - GtkRadioButton - bbirth1 - True - - False - True - birth - - 2 - 3 - 4 - 6 - 0 - 0 - False - False - True - True - False - False - - - - - GtkLabel - label57 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - id1_text - True - False - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - name1_text - True - False - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkRadioButton - id1 - True - - False - True - id - - 2 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHSeparator - hseparator11 - - 0 - 3 - 1 - 2 - 0 - 0 - False - True - False - False - True - True - - - - - - - GtkFrame - PersonFrame2 - 300 - - 0 - GTK_SHADOW_ETCHED_IN - - 2 - True - True - - - - GtkTable - table4 - 14 - 3 - False - 0 - 2 - - - GtkLabel - label13 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 7 - 8 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label25 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 11 - 12 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label27 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 5 - 6 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label9 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label32 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 8 - 9 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - name2_text - True - False - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - birth2_text - True - False - True - 0 - - - 1 - 2 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - bplace2_text - True - False - True - 0 - - - 1 - 2 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - death2_text - True - False - True - 0 - - - 1 - 2 - 7 - 8 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - dplace2_text - True - False - True - 0 - - - 1 - 2 - 8 - 9 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - father2 - True - False - True - 0 - - - 1 - 2 - 10 - 11 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - mother2 - True - False - True - 0 - - - 1 - 2 - 11 - 12 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label34 - - GTK_JUSTIFY_CENTER - False - 1 - 0 - 5 - 0 - - 0 - 1 - 13 - 14 - 0 - 0 - False - True - False - False - True - True - - - - - GtkLabel - label19 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 10 - 11 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHSeparator - hseparator3 - - 0 - 3 - 9 - 10 - 0 - 5 - False - False - False - False - True - True - - - - - GtkHSeparator - hseparator5 - - 0 - 3 - 12 - 13 - 0 - 5 - False - False - False - False - True - True - - - - - GtkScrolledWindow - scrolledwindow2 - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 3 - 13 - 14 - 0 - 0 - False - False - False - False - True - True - - - - GtkCList - spouse2 - True - 1 - 80 - GTK_SELECTION_SINGLE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label50 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GtkHSeparator - hseparator9 - - 0 - 3 - 3 - 4 - 0 - 0 - False - True - False - False - True - True - - - - - GtkHSeparator - hseparator10 - - 0 - 3 - 6 - 7 - 0 - 0 - False - True - False - False - True - True - - - - - GtkRadioButton - bbirth2 - True - - False - True - birth - - 2 - 3 - 4 - 6 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - death2 - True - - False - True - death - - 2 - 3 - 7 - 9 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - bfather2 - True - - False - True - father - - 2 - 3 - 10 - 12 - 0 - 0 - False - False - True - False - False - False - - - - - GtkLabel - label58 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label59 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - id2_text - True - False - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkRadioButton - radiobutton2 - True - - False - True - name - - 2 - 3 - 0 - 1 - 0 - 0 - False - False - True - False - False - False - - - - - GtkRadioButton - id2 - True - - False - True - id - - 2 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkHSeparator - hseparator12 - - 0 - 3 - 1 - 2 - 0 - 0 - False - True - False - False - True - True - - - - - - - - GtkHBox - hbox7 - False - 0 - - 3 - False - True - - - - GtkLabel - label53 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - True - True - - - - - GtkVBox - vbox3 - False - 0 - - 0 - False - False - - - - GtkCheckButton - altname - True - - False - True - - 0 - False - False - - - - - GtkCheckButton - altbirth - True - - False - True - - 0 - False - False - - - - - GtkCheckButton - altdeath - True - - False - True - - 0 - False - False - - - - - - GtkLabel - label54 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - True - True - - - - - - - + diff --git a/gramps2/src/plugins/EventCmp.py b/gramps2/src/plugins/EventCmp.py index 7fd38b2a8..f163e1e6d 100644 --- a/gramps2/src/plugins/EventCmp.py +++ b/gramps2/src/plugins/EventCmp.py @@ -31,10 +31,10 @@ import Utils import string import const import GenericFilter +import ListModel from TextDoc import * from OpenSpreadSheet import * -import intl -_ = intl.gettext +from intl import gettext as _ import gnome.ui import gtk @@ -167,11 +167,8 @@ def by_value(first,second): # #------------------------------------------------------------------------- def fix(line): - l = string.strip(line) - l = string.replace(l,'&','&') - l = string.replace(l,'>','>') - l = string.replace(l,'<','<') - return string.replace(l,'"','"') + l = line.strip().replace('&','&').replace(l,'>','>') + return l.replace(l,'<','<').replace(l,'"','"') #------------------------------------------------------------------------- # @@ -193,7 +190,7 @@ class DisplayChart: }) self.top = self.topDialog.get_widget("view") - self.table = self.topDialog.get_widget("addarea") + self.eventlist = self.topDialog.get_widget('treeview') self.my_list.sort(sort.by_last_name) @@ -204,17 +201,19 @@ class DisplayChart: def draw_clist_display(self): - eventlist = gtk.CList(len(self.event_titles),self.event_titles) - self.table.add(eventlist) - eventlist.show() + titles = [] + index = 0 + for v in self.event_titles: + titles.append((v,150,index)) + index = index + 1 + + self.list = ListModel.ListModel(self.eventlist,titles) + for data in self.row_data: + self.list.add(data) - for (top,bottom) in self.row_data: - eventlist.append(top) - eventlist.append(bottom) - - for index in range(0,len(self.event_titles)): - width = min(150,eventlist.optimal_column_width(index)) - eventlist.set_column_width(index,width) +# for index in range(0,len(self.event_titles)): +# width = min(150,eventlist.optimal_column_width(index)) +# self.eventlist.set_column_width(index,width) def build_row_data(self): for individual in self.my_list: @@ -235,29 +234,26 @@ class DisplayChart: while done == 0: added = 0 if first: - tlist = [name,birth.getDate(),death.getDate()] - blist = ["",birth.getPlaceName(),death.getPlaceName()] + tlist = [name,"%s\n%s" % (birth.getDate(),birth.getPlaceName()), + "%s\n%s" % (death.getDate(),death.getPlaceName())] else: tlist = ["","",""] - blist = ["","",""] for ename in self.event_titles[3:]: if map.has_key(ename) and len(map[ename]) > 0: event = map[ename][0] del map[ename][0] - tlist.append(event.getDate()) - blist.append(event.getPlaceName()) + tlist.append("%s\n%s" % (event.getDate(), event.getPlaceName())) added = 1 else: tlist.append("") - blist.append("") if first: first = 0 - self.row_data.append((tlist,blist)) + self.row_data.append(tlist) elif added == 0: done = 1 else: - self.row_data.append((tlist,blist)) + self.row_data.append(tlist) def make_event_titles(self): """Creates the list of unique event types, along with the person's @@ -330,6 +326,8 @@ register_tool( runTool, _("Compare individual events"), category=_("Analysis and Exploration"), - description=_("Aids in the analysis of data by allowing the development of custom filters that can be applied to the database to find similar events") + description=_("Aids in the analysis of data by allowing the " + "development of custom filters that can be applied " + "to the database to find similar events") ) diff --git a/gramps2/src/plugins/Merge.py b/gramps2/src/plugins/Merge.py index 9977ebb44..462809bfa 100644 --- a/gramps2/src/plugins/Merge.py +++ b/gramps2/src/plugins/Merge.py @@ -24,6 +24,7 @@ import RelLib import Utils import soundex import GrampsCfg +import ListModel from intl import gettext as _ import string @@ -43,11 +44,16 @@ def is_initial(name): if len(name) > 2: return 0 elif len(name) == 2: - if name[0] in string.uppercase and name[1] == '.': + if name[0] == name[0].upper() and name[1] == '.': return 1 else: - return name[0] in string.uppercase + return name[0] == name[0].upper() +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- def ancestors_of(p1,list): if p1 == None or p1 in list: return @@ -113,9 +119,11 @@ class Merge: self.show() def progress_update(self,val): - self.progress.set_value(val) - while gtk.events_pending(): - gtk.mainiteration() + pass +# self.progress.set_value(val) +# while gtk.events_pending(): +# gtk.mainiteration() + def find_potentials(self,thresh): top = gtk.glade.XML(self.glade_file,"message") @@ -131,19 +139,20 @@ class Merge: key = self.gen_key(p1.getPrimaryName().getSurname()) if p1.getGender() == RelLib.Person.male: if males.has_key(key): - males[key].append(p1) + males[key].append(p1.getId()) else: - males[key] = [p1] + males[key] = [p1.getId()] else: if females.has_key(key): - females[key].append(p1) + females[key].append(p1.getId()) else: - females[key] = [p1] + females[key] = [p1.getId()] length = len(self.person_list) num = 0 for p1 in self.person_list: + p1key = p1.getId() if num % 25 == 0: self.progress_update((float(num)/float(length))*100) num = num + 1 @@ -155,26 +164,27 @@ class Merge: remaining = females[key] index = 0 - for p2 in remaining: + for p2key in remaining: index = index + 1 - if p1 == p2: + if p1key == p2key: continue - if self.map.has_key(p2): - (v,c) = self.map[p2] + p2 = self.db.getPerson(p2key) + if self.map.has_key(p2key): + (v,c) = self.map[p2key] if v == p1: continue chance = self.compare_people(p1,p2) if chance >= thresh: - if self.map.has_key(p1): - val = self.map[p1] + if self.map.has_key(p1key): + val = self.map[p1key] if val[1] > chance: - self.map[p1] = (p2,chance) + self.map[p1key] = (p2,chance) else: - self.map[p1] = (p2,chance) + self.map[p1key] = (p2,chance) - self.list = self.map.keys()[:] - self.list.sort(by_id) + self.list = self.map.keys() + self.list.sort() self.length = len(self.list) self.topWin.destroy() self.dellist = {} @@ -188,6 +198,12 @@ class Merge: "on_do_merge_clicked" : self.on_do_merge_clicked, }) self.mlist.connect('button-press-event',self.button_press_event) + + self.list = ListModel.ListModel(self.mlist, + [(_('Rating'),75,0), + (_('First Person'),200,1), + (_('Second Person'),200,2)]) + self.redraw() def redraw(self): @@ -196,39 +212,41 @@ class Merge: if self.dellist.has_key(p1): continue (p2,c) = self.map[p1] - if self.dellist.has_key(p2): - p2 = self.dellist[p2] + p2key = p2.getId() + if self.dellist.has_key(p2key): + p2 = self.dellist[p2key] if p1 == p2: continue - list.append((c,p1,p2)) + list.append((c,p1,p2.getId())) list.sort() list.reverse() index = 0 - self.mlist.freeze() - self.mlist.clear() + self.match_map = {} + self.list.clear() for (c,p1,p2) in list: c = "%5.2f" % c - self.mlist.append([c, name_of(p1), name_of(p2)]) - self.mlist.set_row_data(index,(p1,p2)) + pn1 = self.db.getPerson(p1) + pn2 = self.db.getPerson(p2) + self.list.add([c, name_of(pn1), name_of(pn2)]) + self.match_map[index] = (p1,p2) index = index + 1 - self.mlist.thaw() def button_press_event(self,obj,event): - if event.button != 1 or event.type != GDK._2BUTTON_PRESS: + if event.button != 1 or event.type != gtk.gdk._2BUTTON_PRESS: return - if len(self.mlist.selection) <= 0: - return - row = self.mlist.selection[0] - (p1,p2) = self.mlist.get_row_data(row) - MergeData.MergePeople(self.db,p1,p2,self.on_update) + self.on_do_merge_clicked(obj) def on_do_merge_clicked(self,obj): - if len(self.mlist.selection) != 1: + store,iter = self.list.selection.get_selected() + if not iter: return - row = self.mlist.selection[0] - (p1,p2) = self.mlist.get_row_data(row) - MergeData.MergePeople(self.db,p1,p2,self.on_update) + + row = self.list.model.get_path(iter) + (p1,p2) = self.match_map[row[0]] + pn1 = self.db.getPerson(p1) + pn2 = self.db.getPerson(p2) + MergeData.MergePeople(self.db,pn1,pn2,self.on_update) def on_update(self,p1,p2): self.dellist[p2] = p1 @@ -389,7 +407,7 @@ class Merge: name1 = p1.getPrimaryName() name2 = p2.getPrimaryName() - + chance = self.name_match(name1,name2) if chance == -1 : return -1 @@ -524,6 +542,7 @@ register_tool( runTool, _("Find possible duplicate people"), category=_("Database Processing"), - description=_("Searches the entire database, looking for individual entries that may represent the same person.") + description=_("Searches the entire database, looking for " + "individual entries that may represent the same person.") ) diff --git a/gramps2/src/plugins/eventcmp.glade b/gramps2/src/plugins/eventcmp.glade index df12e7148..37210d029 100644 --- a/gramps2/src/plugins/eventcmp.glade +++ b/gramps2/src/plugins/eventcmp.glade @@ -1,547 +1,569 @@ - + - + - - Save as a Spreadsheet - GRAMPS - GTK_WINDOW_DIALOG - no - no - no - yes - GTK_WIN_POS_NONE + + True + Save as a Spreadsheet - GRAMPS + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True - - - no - 8 - yes + + + True + False + 8 - - - GTK_BUTTONBOX_END - 8 - yes + + + True + GTK_BUTTONBOX_END - - - yes - yes - yes - gtk-ok - yes - yes + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + 0 + + + - - - + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + 0 + + + + + + 0 + False + True + GTK_PACK_END + + - - - yes - yes - yes - gtk-cancel - yes - yes + + + True + False + 0 - - - - - - 0 - no - yes - GTK_PACK_END - - + + + True + Save data as a spreadsheet + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + - - - no - 0 - yes + + + True + + + 5 + True + True + + - - - Save data as a spreadsheet - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 0 - 0 - yes - - - 0 - no - no - - + + + True + table_data + 10 + Save Data + False + False - - - yes - - - 5 - yes - yes - - + + + True + True + True + True + 0 + + True + * + False + + + + + 5 + False + False + + - - - table_data - no - 350 - no - Save Data - yes + + + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN - - - yes - yes - - 0 - yes - yes - - - - - 5 - no - no - - + + + True + False + 0 - - - Format - 0 - GTK_SHADOW_ETCHED_IN - yes + + + True + True + OpenOffice Spreadsheet + True + GTK_RELIEF_NORMAL + True + False + True + + + 0 + False + False + + - - - no - 0 - yes + + + True + HTML + True + GTK_RELIEF_NORMAL + False + False + True + openoffice + + + + 0 + False + False + + - - - yes - OpenOffice Spreadsheet - yes - yes - yes - - - 0 - no - no - - + + + True + False + 0 - - - no - yes - HTML - no - yes - openoffice + + + - - - - 0 - no - no - - + + + Template + False + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 5 + 0 + + + 0 + True + True + + - - - no - 0 - yes + + + False + HtmlTemplate + 10 + Choose the HTML template + False + False - - - + + + True + True + True + True + 0 + + True + * + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + - - - no - Template - GTK_JUSTIFY_CENTER - no - 1 - 0.5 - 5 - 0 - - - 0 - yes - yes - - + + + True + Format + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + + + + + 0 + True + True + + + + + - - - no - no - HtmlTemplate - no - no - Choose the HTML template + + True + Event Comparison - GRAMPS + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 500 + 400 + True + False + True - - - yes - yes - - 0 - yes - yes - - - - - 0 - yes - yes - - - - - 0 - yes - yes - - - - - - - 0 - yes - yes - - - - - 0 - yes - yes - - - - - 4 - yes - yes - - - - - Event Comparison - GRAMPS - GTK_WINDOW_TOPLEVEL - no - no - yes - 350 - yes - GTK_WIN_POS_NONE + + + True + False + 8 - - - no - 8 - yes + + + True + GTK_BUTTONBOX_END - - - GTK_BUTTONBOX_END - 8 - yes + + + True + True + True + gtk-save-as + True + GTK_RELIEF_NORMAL + 0 + + + - - - yes - yes - Save As... - yes + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + 0 + + + + + + 0 + False + True + GTK_PACK_END + + - - - + + + True + 2 + 1 + False + 0 + 0 - - - yes - yes - yes - gtk-close - yes - yes + + + True + Event Comparison + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + 10 + fill + + + - - - - - - 0 - no - yes - GTK_PACK_END - - + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT - - - no - 0 - 0 - 2 - 1 - yes + + + True + True + True + True + False + True + + + + + 0 + 1 + 1 + 2 + + + + + 0 + True + True + + + + + - - - Event Comparison - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 0 - 0 - 400 - yes - - - 0 - 1 - 0 - 1 - 0 - 10 - fill - - - + + True + Event Comparison - GRAMPS + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True - - - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - yes + + + True + False + 8 - - - + + + True + GTK_BUTTONBOX_END - - - GTK_UPDATE_CONTINUOUS - yes - - + + + True + True + True + gtk-apply + True + GTK_RELIEF_NORMAL + 0 + + + - - - GTK_UPDATE_CONTINUOUS - yes - - - - - 0 - 1 - 1 - 2 - 0 - 0 - expand|fill - expand|fill - - - - - 0 - yes - yes - - - - - 4 - yes - yes - - - - - Event Comparison - GRAMPS - GTK_WINDOW_TOPLEVEL - no - no - no - 350 - yes - GTK_WIN_POS_NONE + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + 0 + + + + + + 0 + False + True + GTK_PACK_END + + - - - no - 8 - yes + + + True + False + 0 - - - GTK_BUTTONBOX_END - 8 - yes + + + True + Event Comparison + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + - - - yes - yes - yes - gtk-apply - yes - yes + + + True + + + 5 + False + True + + + + + 0 + False + True + + - - - + + + True + False + 0 - - - yes - yes - yes - gtk-cancel - yes - yes + + + True + Filter + False + False + GTK_JUSTIFY_CENTER + False + False + 1 + 0.5 + 5 + 0 + + + 0 + False + False + + - - - - - - 0 - no - yes - GTK_PACK_END - - + + + True + True + -1 - - - no - 0 - yes + + + True + + + + + 0 + True + True + + + + + 0 + False + True + + + + + - - - Event Comparison - GTK_JUSTIFY_CENTER - no - 0.5 - 0.5 - 0 - 0 - yes - - - 0 - no - no - - - - - - yes - - - 5 - no - yes - - - - - 0 - no - yes - - - - - - no - 0 - yes - - - - Filter - GTK_JUSTIFY_CENTER - no - 1 - 0.5 - 5 - 0 - yes - - - 0 - no - no - - - - - - yes - 0 - yes - - - - yes - - - - - 0 - yes - yes - - - - - 0 - no - yes - - - - - 4 - yes - yes - - -