diff --git a/src/AddSpouse.py b/src/AddSpouse.py index 9e3106143..c2a8550d4 100644 --- a/src/AddSpouse.py +++ b/src/AddSpouse.py @@ -62,7 +62,7 @@ class AddSpouse: family with the passed person as one spouse, and another person to be selected. """ - def __init__(self,db,person,update,addperson): + def __init__(self,db,person,update,addperson,family=None): """ Displays the AddSpouse dialog box. @@ -75,6 +75,7 @@ class AddSpouse: self.update = update self.person = person self.addperson = addperson + self.active_family = family self.glade = gtk.glade.XML(const.gladeFile, "spouseDialog") @@ -166,20 +167,21 @@ class AddSpouse: return Utils.modified() - family = self.db.newFamily() - self.person.addFamily(family) - spouse.addFamily(family) + if not self.active_family: + self.active_family = self.db.newFamily() + self.person.addFamily(self.active_family) + spouse.addFamily(self.active_family) if self.person.getGender() == RelLib.Person.male: - family.setMother(spouse) - family.setFather(self.person) + self.active_family.setMother(spouse) + self.active_family.setFather(self.person) else: - family.setFather(spouse) - family.setMother(self.person) + self.active_family.setFather(spouse) + self.active_family.setMother(self.person) - family.setRelationship(const.save_frel(self.relation_type.get_text())) + self.active_family.setRelationship(const.save_frel(self.relation_type.get_text())) Utils.destroy_passed_object(obj) - self.update(family) + self.update(self.active_family) def relation_type_changed(self,obj): self.update_data() diff --git a/src/AttrEdit.py b/src/AttrEdit.py index ce4dfb4a8..6c766877e 100644 --- a/src/AttrEdit.py +++ b/src/AttrEdit.py @@ -130,7 +130,6 @@ class AttributeEditor: self.attrib.setSourceRefList(self.srcreflist) self.update(type,value,note,priv) - print self.parent self.parent.redraw_attr_list() Utils.destroy_passed_object(obj) diff --git a/src/EditPerson.py b/src/EditPerson.py index abcc74542..7d647bb25 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -747,7 +747,8 @@ class EditPerson: _("Are you sure you want to abandon your changes?"), self.cancel_callback) else: - Utils.destroy_passed_object(obj) + self.gallery.close() + self.window.destroy() def on_delete_event(self,obj,b): """If the data has changed, give the user a chance to cancel @@ -758,12 +759,14 @@ class EditPerson: self.cancel_callback) return 1 else: - Utils.destroy_passed_object(obj) + self.gallery.close() + self.window.destroy() return 0 def cancel_callback(self): """If the user answered yes to abandoning changes, close the window""" - Utils.destroy_passed_object(self.window) + self.gallery.close() + self.window.destroy() def did_data_change(self): """Check to see if any of the data has changed from the @@ -1257,7 +1260,8 @@ class EditPerson: self.update_lists() if self.callback: self.callback(self,self.add_places) - Utils.destroy_passed_object(obj) + self.gallery.close() + self.window.destroy() def get_place(self,field,makenew=0): text = string.strip(field.get_text()) diff --git a/src/EditPlace.py b/src/EditPlace.py index 10f56124e..097d76446 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -136,7 +136,7 @@ class EditPlace: self.note_buffer.set_text(place.getNote()) self.top_window.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, + "destroy_passed_object" : self.close, "on_switch_page" : self.on_switch_page, "on_addphoto_clicked" : self.glry.on_add_photo_clicked, "on_deletephoto_clicked" : self.glry.on_delete_photo_clicked, @@ -173,6 +173,10 @@ class EditPlace: self.redraw_url_list() self.redraw_location_list() + + def close(self): + self.glry.close() + self.top.close() def build_columns(self,tree,list): cnum = 0 @@ -261,7 +265,7 @@ class EditPlace: self.update_lists() - Utils.destroy_passed_object(self.top) + self.close(None) if self.callback: self.callback(self.place) diff --git a/src/EditSource.py b/src/EditSource.py index 404a4d77a..1a98de3e4 100644 --- a/src/EditSource.py +++ b/src/EditSource.py @@ -73,7 +73,7 @@ class EditSource: self.notes_buffer.set_text(source.getNote()) self.top_window.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, + "destroy_passed_object" : self.close, "on_switch_page" : self.on_switch_page, "on_addphoto_clicked" : self.gallery.on_add_photo_clicked, "on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked, @@ -87,6 +87,10 @@ class EditSource: self.top_window.get_widget("add_photo").set_sensitive(0) self.top_window.get_widget("delete_photo").set_sensitive(0) + def close(self,obj): + self.gallery.close() + self.top.destroy() + def display_references(self): p_event_list = [] p_attr_list = [] @@ -197,7 +201,8 @@ class EditSource: self.source.setNote(note) Utils.modified() - Utils.destroy_passed_object(self.top) + self.close(None) + if self.callback: self.callback(self.source) diff --git a/src/FamilyView.py b/src/FamilyView.py index ba058666a..937351638 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -83,6 +83,7 @@ class FamilyView: self.spouse_list.set_model(self.spouse_model) self.spouse_selection = self.spouse_list.get_selection() self.spouse_selection.connect('changed',self.spouse_changed) + self.spouse_list.connect('button-press-event',self.edit_relationship) self.top.get_widget('add_parents').connect('clicked',self.add_parents_clicked) self.top.get_widget('del_parents').connect('clicked',self.del_parents_clicked) @@ -111,7 +112,6 @@ class FamilyView: self.swap_btn.connect('clicked',self.spouse_swap) self.remove_spouse_btn.connect('clicked',self.remove_spouse) self.add_spouse_btn.connect('clicked',self.add_spouse) - self.spouse_list.connect('button-press-event',self.edit_releationship) self.child_list.set_model(self.child_model) self.child_list.set_search_column(0) @@ -137,12 +137,18 @@ class FamilyView: row = model.get_path(iter) self.display_marriage(self.person.getFamilyList()[row[0]]) - def edit_releationship(self,obj,event): + def edit_relationship(self,obj,event): if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if self.person: try: - Marriage.Marriage(self.family,self.parent.db, - self.parent.new_after_edit) + if self.selected_spouse: + Marriage.Marriage(self.family,self.parent.db, + self.parent.new_after_edit) + else: + AddSpouse.AddSpouse(self.parent.db,self.person, + self.load_family, + self.parent.redisplay_person_list, + self.family) except: DisplayTrace.DisplayTrace() @@ -182,9 +188,9 @@ class FamilyView: if len(self.family.getChildList()) == 0: if self.family.getFather() == None: - self.parent.delete_family_from(self.family.getMother()) + self.delete_family_from(self.family.getMother()) elif self.family.getMother() == None: - self.parent.delete_family_from(self.family.getFather()) + self.delete_family_from(self.family.getFather()) Utils.modified() self.load_family() @@ -341,6 +347,15 @@ class FamilyView: else: return _("%s: unknown") % (l) + def delete_family_from(self,person): + person.removeFamily(self.family) + self.db.deleteFamily(self.family) + flist = self.person.getFamilyList() + if len(flist) > 0: + self.family = flist[0][0] + else: + self.family = None + def display_marriage(self,family): self.child_model.clear() diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 59118a953..19b953a5e 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -26,7 +26,7 @@ import os import string import urlparse - +import gc #------------------------------------------------------------------------- # # GTK/Gnome modules @@ -80,7 +80,6 @@ class ImageSelect: self.dataobj = None self.parent = parent self.canvas_list = {} - self.item_map = {} self.p_map = {} def add_thumbnail(self, photo): @@ -218,15 +217,14 @@ class Gallery(ImageSelect): icon_list.connect("drag_data_get", self.on_photolist_drag_data_get) - icon_list.connect('destroy',self.unmap) # Remember arguments self.path = path; self.dataobj = dataobj; self.iconlist = icon_list; - self.root = self.iconlist.root() + self.root = self.iconlist.root() # Local object variables - self.x = 0 + x = 0 self.y = 0 self.remember_x = -1 self.remember_y = -1 @@ -235,10 +233,14 @@ class Gallery(ImageSelect): self.sel = None self.photo = None - def unmap(self,obj): - for i in self.item_map.keys(): - print i - i.destroy() + def close(self): +# self.iconlist.hide() +# print self.canvas_list +# print self.p_map +# self.canvas_list = None +# self.p_map = None +# gc.collect() +# self.iconlist.destroy() def on_canvas1_event(self,obj,event): """Handle resize events over the canvas, redrawing if the size changes""" @@ -352,14 +354,8 @@ class Gallery(ImageSelect): justification=gtk.JUSTIFY_CENTER, y=_IMAGEY-10, text=description) - self.item_map[box] = oid - self.item_map[text] = oid - self.item_map[grp] = oid - self.item_map[item] = oid - for i in [ item, text, box, grp ] : - self.item_map[i] = oid - self.p_map[i] = (item,text,box,photo) + self.p_map[i] = (item,text,box,photo,oid) i.show() self.canvas_list[oid] = (grp,item,text,self.cx,self.cy) @@ -375,6 +371,7 @@ class Gallery(ImageSelect): Imlibs. Then add each photo in the place's list of photos to the photolist window.""" + print "load images" self.pos = 0 self.cx = _PAD self.cy = _PAD @@ -491,8 +488,8 @@ class Gallery(ImageSelect): def on_photolist_drag_data_get(self,w, context, selection_data, info, time): if info == 1: return - id = self.item_map[self.drag_item] - selection_data.set(selection_data.target, 8, id) + id = self.p_map[self.drag_item] + selection_data.set(selection_data.target, 8, id[4]) self.drag_item = None def on_add_photo_clicked(self, obj): diff --git a/src/MergeData.py b/src/MergeData.py index 62389d8b1..c44f07ca8 100644 --- a/src/MergeData.py +++ b/src/MergeData.py @@ -186,7 +186,6 @@ class MergePeople: else: sname = GrampsCfg.nameof(spouse) name = "%s [%s]" % (sname,spouse.getId()) - print name, widget widget.add([name]) def set_field(self,widget,value): diff --git a/src/Report.py b/src/Report.py index 2331b61ae..0aab2f439 100644 --- a/src/Report.py +++ b/src/Report.py @@ -889,7 +889,9 @@ class ReportDialog: self.report_menu = None if self.extra_textbox: - self.report_text = string.split(self.extra_textbox.get_chars(0,-1),'\n') + b = self.extra_textbox.get_buffer() + text_val = b.get_text(b.get_start_iter(),b.get_end_iter(),gtk.FALSE) + self.report_text = string.split(text_val,'\n') else: self.report_text = "" diff --git a/src/SelectChild.py b/src/SelectChild.py index 03ba2f6c5..9c35cd08d 100644 --- a/src/SelectChild.py +++ b/src/SelectChild.py @@ -235,7 +235,6 @@ class SelectChild: depending on the gender of the person.""" id = person.getId() dinfo = self.db.getPersonDisplay(id) - print dinfo rdata = [dinfo[0],dinfo[1],dinfo[3],dinfo[5],dinfo[6]] self.refmodel.add_and_select(rdata) self.add_person(person) diff --git a/src/SubstKeywords.py b/src/SubstKeywords.py index 79208d10b..f8ef04169 100644 --- a/src/SubstKeywords.py +++ b/src/SubstKeywords.py @@ -74,34 +74,25 @@ class SubstKeywords: self.D = person.getDeath().getPlaceName() self.i = str(person.getId()) - if len(person.getFamilyList()) > 0: + self.s = "" + self.S = "" + self.m = "" + self.M = "" + + if person.getFamilyList(): f = person.getFamilyList()[0] if f.getFather() == person: if f.getMother(): self.s = f.getMother().getPrimaryName().getRegularName() self.S = f.getMother().getPrimaryName().getName() - else: - self.s = "" - self.S = "" else: if f.getFather(): self.s = f.getFather().getPrimaryName().getRegularName() self.S = f.getFather().getPrimaryName().getName() - else: - self.s = "" - self.S = "" - - self.m = '' - self.M = '' for e in f.getEventList(): if e.getName == 'Marriage': self.m = e.getDate() - self.M = e.getPlace() - else: - self.s = "" - self.S = "" - self.m = "" - self.M = "" + self.M = e.getPlaceName() def replace(self,line): """Returns a new line of text with the substitutions performed.""" diff --git a/src/gramps.glade b/src/gramps.glade index 7df78a99a..575838c3a 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -1940,10 +1940,6 @@ True 0 - - - - True @@ -1964,12 +1960,16 @@ - 0 + 5 False False + + + + True @@ -1990,15 +1990,11 @@ - 0 + 5 False False - - - - 1 diff --git a/src/latin_ansel.py b/src/latin_ansel.py index 7621fd910..97dea5e16 100644 --- a/src/latin_ansel.py +++ b/src/latin_ansel.py @@ -130,60 +130,3 @@ def latin_to_ansel(s): buff.close() return ans -if __name__ == "__main__": - - print 'static unsigned char s0[] = {' - for i in range(256): - if i == 255: - suf = '};\n\n' - else: - suf = ',' - if i%16 == 0 and i != 0: - print '\n', - try: - print "%3d%s" % (_s0[i],suf), - except: - print "%3d%s" % (i,suf), - - print 'static unsigned char t0[] = {' - for i in range(256): - if i == 255: - suf = '};\n\n' - else: - suf = ',' - if i%16 == 0 and i != 0: - print '\n', - try: - print "%3d%s" % (ord(_t0[i]),suf), - except KeyError: - print '0%s' % suf, - - print 'static unsigned char* t1[] = {' - for i in range(256): - if i == 255: - suf = '};\n\n' - else: - suf = ',' - if i%8== 0 and i != 0: - print '\n', - try: - t = _t1[i] - print '"\\%03o\\%03o"%s' % (ord(t[0]),ord(t[1]),suf), - except KeyError: - print '"\\%03o"%s' % (i,suf), - - for key in _s1.keys(): - print 'static unsigned char s_%x[] = {' % key - for i in range(256): - if i == 255: - suf = '};\n\n' - else: - suf = ',' - if i%16 == 0 and i != 0: - print '\n', - try: - print "%3d%s" % (_s1[key][i],suf), - except: - print "%3d%s" % (i,suf), - - diff --git a/src/plugins/DesGraph.py b/src/plugins/DesGraph.py index 5a50517b0..2dfd2268c 100644 --- a/src/plugins/DesGraph.py +++ b/src/plugins/DesGraph.py @@ -84,17 +84,17 @@ class DescendantReport: self.text = {} for (p,x,y) in self.v: - self.text[p] = [] + self.text[p.getId()] = [] subst = SubstKeywords(p) for line in self.display: - self.text[p].append(subst.replace(line)) + self.text[p.getId()].append(subst.replace(line)) self.font = self.doc.style_list["Normal"].get_font() - for line in self.text[p]: + for line in self.text[p.getId()]: new_width = string_width(self.font,line) self.box_width = max(self.box_width,new_width) - self.lines = max(self.lines,len(self.text[p])) + self.lines = max(self.lines,len(self.text[p.getId()])) def write_report(self): @@ -242,7 +242,7 @@ class DescendantReport: if plist: for (p,x,y) in plist: - name = string.join(self.text[p],"\n") + name = string.join(self.text[p.getId()],"\n") x = (x-1)*delta + left + _sep y = (y-1)*(self.height+_sep)+top self.doc.draw_box("box",name,x,y) diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index 02e500d04..ee4e0eeea 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -1414,7 +1414,7 @@ class GedcomParser: self.code = ANSEL self.cnv = ansel_to_utf8 else: - self.cnv = latin_to_utf8 + self.cnv = latin_utf8.latin_to_utf8 self.ignore_sub_junk(2) self.update(self.encoding_obj,matches[2]) elif matches[1] == "GEDC": diff --git a/src/plugins/WebPage.py b/src/plugins/WebPage.py index e00efffb7..04e51cb23 100644 --- a/src/plugins/WebPage.py +++ b/src/plugins/WebPage.py @@ -784,8 +784,8 @@ class WebReport(Report): idoc.create_page() idoc.close() self.progress_bar_step() - while events_pending(): - mainiteration() + while gtk.events_pending(): + gtk.mainiteration() if len(ind_list) > 1: self.dump_index(ind_list,self.selected_style,