From ccdf09c49955f7d90ed2ebab3893ed3065025f7e Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 10 Feb 2003 04:11:01 +0000 Subject: [PATCH] Catch the change in API for gtk.TextBuffer svn: r1295 --- gramps2/src/FamilyView.py | 10 ++++++++-- gramps2/src/Report.py | 7 ++++++- gramps2/src/plugins/ReadGedcom.py | 22 +++++++++++++--------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 4e66e3ebc..cbaba7ab2 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -135,6 +135,8 @@ class FamilyView: self.child_list.set_search_column(0) self.child_selection = self.child_list.get_selection() + self.family = None + Utils.build_columns(self.child_list, [ ('',30,-1), (_('Name'),250,-1), (_('ID'),50,-1), (_('Gender'),100,-1), (_('Birth Date'),150,-1), @@ -183,7 +185,7 @@ class FamilyView: def add_child_clicked(self,obj): if not self.person: return - try: + try:x SelectChild.SelectChild(self.parent.db, self.family, self.person, self.load_family, self.parent.update_person_list) @@ -290,7 +292,11 @@ class FamilyView: n = "%s\n\tb. %s\n\td. %s " % (GrampsCfg.nameof(self.person), self.person.getBirth().getDate(), self.person.getDeath().getDate()) - self.ap_data.set_text(n,len(n)) + + try: + self.ap_data.set_text(n,len(n)) + except TypeError: + self.ap_data.set_text(n) self.selected_spouse = None self.spouse_model.clear() diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index 7cf1631a1..8d3eefae1 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -755,7 +755,12 @@ class ReportDialog: self.extra_textbox_label = gtk.Label(et_label) self.extra_textbox_label.set_alignment(1.0,0) self.extra_textbox = gtk.TextView() - self.extra_textbox.get_buffer().set_text(string,len(string)) + + try: + self.extra_textbox.get_buffer().set_text(string,len(string)) + except TypeError: + self.extra_textbox.get_buffer().set_text(string) + self.extra_textbox.set_editable(1) self.add_tooltip(self.extra_textbox,et_tip) table.attach(self.extra_textbox_label,0,1,row,row+1,xoptions=gtk.FILL, diff --git a/gramps2/src/plugins/ReadGedcom.py b/gramps2/src/plugins/ReadGedcom.py index 5e33146c9..e37e40e33 100644 --- a/gramps2/src/plugins/ReadGedcom.py +++ b/gramps2/src/plugins/ReadGedcom.py @@ -258,6 +258,12 @@ class GedcomParser: except: pass + def errmsg(self,msg): + try: + self.error_text_obj.get_buffer().insert_at_cursor(msg) + except TypeError: + self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + def find_file(self,fullname,altpath): fullname = string.replace(fullname,'\\','/') if os.path.isfile(fullname): @@ -304,9 +310,8 @@ class GedcomParser: self.groups = (int(l[0]),l[1],l[2]) except: msg = _("Warning: line %d was not understood, so it was ignored.") % self.index - self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) - msg = "\n\t%s\n" % self.text - self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + msg = "%s\n\t%s\n" % (msg,self.text) + self.errmsg(msg) self.error_count = self.error_count + 1 if self.window: self.update(self.errors_obj,str(self.error_count)) @@ -317,13 +322,13 @@ class GedcomParser: def barf(self,level): msg = _("Warning: line %d was not understood, so it was ignored.") % self.index if self.window: - self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + self.errmsg(msg) else: print msg msg = "\n\t%s\n" % self.text if self.window: - self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + self.errmsg(msg) self.error_count = self.error_count + 1 self.update(self.errors_obj,str(self.error_count)) else: @@ -332,7 +337,7 @@ class GedcomParser: def warn(self,msg): if self.window: - self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + self.errmsg(msg) self.error_count = self.error_count + 1 self.update(self.errors_obj,str(self.error_count)) else: @@ -352,8 +357,7 @@ class GedcomParser: self.parse_record() self.parse_trailer() except Errors.GedcomError, err: - msg = str(err) - self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + self.errmsg(str(err)) if self.window: self.update(self.families_obj,str(self.fam_count)) @@ -363,7 +367,7 @@ class GedcomParser: t = time.time() - t msg = _('Import Complete: %d seconds') % t if self.window: - self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) + self.errmsg(msg) return self.close_done.get_active() else: print msg