Catch the change in API for gtk.TextBuffer

svn: r1295
This commit is contained in:
Don Allingham 2003-02-10 04:11:01 +00:00
parent 9d892febfa
commit 0e8a88146a
3 changed files with 27 additions and 12 deletions

View File

@ -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())
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()

View File

@ -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()
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,

View File

@ -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