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 1b77bc6617
commit ccdf09c499
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_list.set_search_column(0)
self.child_selection = self.child_list.get_selection() self.child_selection = self.child_list.get_selection()
self.family = None
Utils.build_columns(self.child_list, Utils.build_columns(self.child_list,
[ ('',30,-1), (_('Name'),250,-1), (_('ID'),50,-1), [ ('',30,-1), (_('Name'),250,-1), (_('ID'),50,-1),
(_('Gender'),100,-1), (_('Birth Date'),150,-1), (_('Gender'),100,-1), (_('Birth Date'),150,-1),
@ -183,7 +185,7 @@ class FamilyView:
def add_child_clicked(self,obj): def add_child_clicked(self,obj):
if not self.person: if not self.person:
return return
try: try:x
SelectChild.SelectChild(self.parent.db, self.family, SelectChild.SelectChild(self.parent.db, self.family,
self.person, self.load_family, self.person, self.load_family,
self.parent.update_person_list) self.parent.update_person_list)
@ -290,7 +292,11 @@ class FamilyView:
n = "%s\n\tb. %s\n\td. %s " % (GrampsCfg.nameof(self.person), n = "%s\n\tb. %s\n\td. %s " % (GrampsCfg.nameof(self.person),
self.person.getBirth().getDate(), self.person.getBirth().getDate(),
self.person.getDeath().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.selected_spouse = None
self.spouse_model.clear() self.spouse_model.clear()

View File

@ -755,7 +755,12 @@ class ReportDialog:
self.extra_textbox_label = gtk.Label(et_label) self.extra_textbox_label = gtk.Label(et_label)
self.extra_textbox_label.set_alignment(1.0,0) self.extra_textbox_label.set_alignment(1.0,0)
self.extra_textbox = gtk.TextView() 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.extra_textbox.set_editable(1)
self.add_tooltip(self.extra_textbox,et_tip) self.add_tooltip(self.extra_textbox,et_tip)
table.attach(self.extra_textbox_label,0,1,row,row+1,xoptions=gtk.FILL, table.attach(self.extra_textbox_label,0,1,row,row+1,xoptions=gtk.FILL,

View File

@ -258,6 +258,12 @@ class GedcomParser:
except: except:
pass 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): def find_file(self,fullname,altpath):
fullname = string.replace(fullname,'\\','/') fullname = string.replace(fullname,'\\','/')
if os.path.isfile(fullname): if os.path.isfile(fullname):
@ -304,9 +310,8 @@ class GedcomParser:
self.groups = (int(l[0]),l[1],l[2]) self.groups = (int(l[0]),l[1],l[2])
except: except:
msg = _("Warning: line %d was not understood, so it was ignored.") % self.index 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 = "%s\n\t%s\n" % (msg,self.text)
msg = "\n\t%s\n" % self.text self.errmsg(msg)
self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg))
self.error_count = self.error_count + 1 self.error_count = self.error_count + 1
if self.window: if self.window:
self.update(self.errors_obj,str(self.error_count)) self.update(self.errors_obj,str(self.error_count))
@ -317,13 +322,13 @@ class GedcomParser:
def barf(self,level): def barf(self,level):
msg = _("Warning: line %d was not understood, so it was ignored.") % self.index msg = _("Warning: line %d was not understood, so it was ignored.") % self.index
if self.window: if self.window:
self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) self.errmsg(msg)
else: else:
print msg print msg
msg = "\n\t%s\n" % self.text msg = "\n\t%s\n" % self.text
if self.window: 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.error_count = self.error_count + 1
self.update(self.errors_obj,str(self.error_count)) self.update(self.errors_obj,str(self.error_count))
else: else:
@ -332,7 +337,7 @@ class GedcomParser:
def warn(self,msg): def warn(self,msg):
if self.window: 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.error_count = self.error_count + 1
self.update(self.errors_obj,str(self.error_count)) self.update(self.errors_obj,str(self.error_count))
else: else:
@ -352,8 +357,7 @@ class GedcomParser:
self.parse_record() self.parse_record()
self.parse_trailer() self.parse_trailer()
except Errors.GedcomError, err: except Errors.GedcomError, err:
msg = str(err) self.errmsg(str(err))
self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg))
if self.window: if self.window:
self.update(self.families_obj,str(self.fam_count)) self.update(self.families_obj,str(self.fam_count))
@ -363,7 +367,7 @@ class GedcomParser:
t = time.time() - t t = time.time() - t
msg = _('Import Complete: %d seconds') % t msg = _('Import Complete: %d seconds') % t
if self.window: if self.window:
self.error_text_obj.get_buffer().insert_at_cursor(msg,len(msg)) self.errmsg(msg)
return self.close_done.get_active() return self.close_done.get_active()
else: else:
print msg print msg