3740: Fix problems with add, delete and update of views when filter applied
svn: r14968
This commit is contained in:
parent
4a807a55e1
commit
4ffef76fac
@ -601,10 +601,11 @@ class FlatBaseModel(gtk.GenericTreeModel):
|
||||
"""
|
||||
Delete a row, called after the object with handle is deleted
|
||||
"""
|
||||
if self.node_map.get_path(handle) is None:
|
||||
return # row is not currently displayed
|
||||
self.clear_cache(handle)
|
||||
data = self.map(handle)
|
||||
delete_val = (map(conv_unicode_tosrtkey_ongtk, self.sort_func(data)),
|
||||
handle)
|
||||
delete_val = (self.node_map.get_sortkey(handle), handle)
|
||||
delete_path = self.node_map.delete(delete_val)
|
||||
#delete_path is an integer from 0 to n-1
|
||||
if delete_path is not None:
|
||||
@ -614,6 +615,8 @@ class FlatBaseModel(gtk.GenericTreeModel):
|
||||
"""
|
||||
Update a row, called after the object with handle is changed
|
||||
"""
|
||||
if self.node_map.get_path(handle) is None:
|
||||
return # row is not currently displayed
|
||||
self.clear_cache(handle)
|
||||
oldsortkey = self.node_map.get_sortkey(handle)
|
||||
newsortkey = map(conv_unicode_tosrtkey_ongtk, self.sort_func(self.map(
|
||||
|
@ -670,8 +670,11 @@ class TreeBaseModel(gtk.GenericTreeModel):
|
||||
Add a row to the model.
|
||||
"""
|
||||
cput = time.clock()
|
||||
data = self.map(handle)
|
||||
self.add_row(handle, data)
|
||||
if not self.search or \
|
||||
(self.search and self.search.match(handle, self.db)):
|
||||
#row needs to be added to the model
|
||||
data = self.map(handle)
|
||||
self.add_row(handle, data)
|
||||
|
||||
_LOG.debug(self.__class__.__name__ + ' add_row_by_handle ' +
|
||||
str(time.clock() - cput) + ' sec')
|
||||
@ -681,9 +684,11 @@ class TreeBaseModel(gtk.GenericTreeModel):
|
||||
Delete a row from the model.
|
||||
"""
|
||||
cput = time.clock()
|
||||
self.clear_cache(handle)
|
||||
|
||||
node = self.get_node(handle)
|
||||
if node is None:
|
||||
return # row not currently displayed
|
||||
|
||||
self.clear_cache(handle)
|
||||
parent = self.nodemap.node(node.parent)
|
||||
self.remove_node(node)
|
||||
|
||||
@ -706,6 +711,9 @@ class TreeBaseModel(gtk.GenericTreeModel):
|
||||
"""
|
||||
Update a row in the model.
|
||||
"""
|
||||
if self.get_node(handle) is None:
|
||||
return # row not currently displayed
|
||||
|
||||
self.delete_row_by_handle(handle)
|
||||
self.add_row_by_handle(handle)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user