Bug 0003785: Unhandled exception - Undo History - ValueError: invalid tree path

svn: r15833
This commit is contained in:
Gerald Britton 2010-08-30 16:37:20 +00:00
parent 8edf5690a4
commit e52db3c15d
2 changed files with 10 additions and 6 deletions

View File

@ -133,14 +133,16 @@ class UndoHistory(ManagedWindow.ManagedWindow):
def _paint_rows(self,start,end,selected=False): def _paint_rows(self,start,end,selected=False):
if selected: if selected:
(fg,bg) = get_colors(self.tree,gtk.STATE_SELECTED) (fg, bg) = get_colors(self.tree,gtk.STATE_SELECTED)
else: else:
fg = bg = None fg = bg = None
for idx in range(start,end+1): for idx in range(start,end+1):
the_iter = self.model.get_iter( (idx,) ) try:
self.model.set(the_iter,2,fg) the_iter = self.model.get_iter( (idx,) )
self.model.set(the_iter,3,bg) self.model.set(the_iter, 2, fg)
self.model.set(the_iter, 3, bg)
except ValueError:
pass
def _response(self, obj,response_id): def _response(self, obj,response_id):
if response_id == gtk.RESPONSE_CLOSE: if response_id == gtk.RESPONSE_CLOSE:
@ -182,7 +184,7 @@ class UndoHistory(ManagedWindow.ManagedWindow):
def clear(self): def clear(self):
self.undodb.clear() self.undodb.clear()
self.undodb.abort_possible = False self.db.abort_possible = False
self.update() self.update()
if self.db.undo_callback: if self.db.undo_callback:
self.db.undo_callback(None) self.db.undo_callback(None)

View File

@ -169,6 +169,8 @@ class DbTxn(defaultdict):
While the list is an arbitrary index of integers, it can be used While the list is an arbitrary index of integers, it can be used
to indicate record numbers for a database. to indicate record numbers for a database.
""" """
if self.first is None or self.last is None:
return []
if not reverse: if not reverse:
return xrange(self.first, self.last+1) return xrange(self.first, self.last+1)
else: else: