3740: Fix problems with add, delete and update of views when filter applied
svn: r14969
This commit is contained in:
parent
17945cd5d2
commit
1832a4335c
@ -601,10 +601,11 @@ class FlatBaseModel(gtk.GenericTreeModel):
|
|||||||
"""
|
"""
|
||||||
Delete a row, called after the object with handle is deleted
|
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)
|
self.clear_cache(handle)
|
||||||
data = self.map(handle)
|
data = self.map(handle)
|
||||||
delete_val = (map(conv_unicode_tosrtkey_ongtk, self.sort_func(data)),
|
delete_val = (self.node_map.get_sortkey(handle), handle)
|
||||||
handle)
|
|
||||||
delete_path = self.node_map.delete(delete_val)
|
delete_path = self.node_map.delete(delete_val)
|
||||||
#delete_path is an integer from 0 to n-1
|
#delete_path is an integer from 0 to n-1
|
||||||
if delete_path is not None:
|
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
|
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)
|
self.clear_cache(handle)
|
||||||
oldsortkey = self.node_map.get_sortkey(handle)
|
oldsortkey = self.node_map.get_sortkey(handle)
|
||||||
newsortkey = map(conv_unicode_tosrtkey_ongtk, self.sort_func(self.map(
|
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.
|
Add a row to the model.
|
||||||
"""
|
"""
|
||||||
cput = time.clock()
|
cput = time.clock()
|
||||||
data = self.map(handle)
|
if not self.search or \
|
||||||
self.add_row(handle, data)
|
(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 ' +
|
_LOG.debug(self.__class__.__name__ + ' add_row_by_handle ' +
|
||||||
str(time.clock() - cput) + ' sec')
|
str(time.clock() - cput) + ' sec')
|
||||||
@ -681,9 +684,11 @@ class TreeBaseModel(gtk.GenericTreeModel):
|
|||||||
Delete a row from the model.
|
Delete a row from the model.
|
||||||
"""
|
"""
|
||||||
cput = time.clock()
|
cput = time.clock()
|
||||||
self.clear_cache(handle)
|
|
||||||
|
|
||||||
node = self.get_node(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)
|
parent = self.nodemap.node(node.parent)
|
||||||
self.remove_node(node)
|
self.remove_node(node)
|
||||||
|
|
||||||
@ -706,6 +711,9 @@ class TreeBaseModel(gtk.GenericTreeModel):
|
|||||||
"""
|
"""
|
||||||
Update a row in the model.
|
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.delete_row_by_handle(handle)
|
||||||
self.add_row_by_handle(handle)
|
self.add_row_by_handle(handle)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user