6126: Filter search bar : FamilyModel has no attribute on_get_value
Fixed at same time other uses of on_ methods which are no longer present Also removed superfluous Maplists action svn: r20672
This commit is contained in:
parent
0eb5c29989
commit
b2d7d5c0b4
@ -522,12 +522,12 @@ class FlatBaseModel(GObject.Object, Gtk.TreeModel):
|
||||
self.search = search[1]
|
||||
self.rebuild_data = self._rebuild_filter
|
||||
else:
|
||||
if search[1]:
|
||||
if search[1]: # Search from topbar in columns
|
||||
# we have search[1] = (index, text_unicode, inversion)
|
||||
col = search[1][0]
|
||||
text = search[1][1]
|
||||
inv = search[1][2]
|
||||
func = lambda x: self.on_get_value(x, col) or UEMPTY
|
||||
func = lambda x: self.get_value_from_handle(x, col) or UEMPTY
|
||||
if search[2]:
|
||||
self.search = ExactSearchFilter(func, text, inv)
|
||||
else:
|
||||
@ -764,13 +764,11 @@ class FlatBaseModel(GObject.Object, Gtk.TreeModel):
|
||||
except IndexError:
|
||||
return False, Gtk.TreeIter()
|
||||
|
||||
def do_get_value(self, iter, col):
|
||||
def get_value_from_handle(self, handle, col):
|
||||
"""
|
||||
See Gtk.TreeModel.
|
||||
col is the model column that is needed, not the visible column!
|
||||
Given handle and column, return unicode value in the column
|
||||
We need this to search in the column in the GUI
|
||||
"""
|
||||
#print 'do_get_val', iter, iter.user_data, col
|
||||
handle = self.node_map._index2hndl[iter.user_data][1]
|
||||
if handle != self.prev_handle:
|
||||
data = self.map(handle)
|
||||
if data is None:
|
||||
@ -778,7 +776,16 @@ class FlatBaseModel(GObject.Object, Gtk.TreeModel):
|
||||
return ''
|
||||
self.prev_data = data
|
||||
self.prev_handle = handle
|
||||
val = self.fmap[col](self.prev_data)
|
||||
return self.fmap[col](self.prev_data)
|
||||
|
||||
def do_get_value(self, iter, col):
|
||||
"""
|
||||
See Gtk.TreeModel.
|
||||
col is the model column that is needed, not the visible column!
|
||||
"""
|
||||
#print 'do_get_val', iter, iter.user_data, col
|
||||
handle = self.node_map._index2hndl[iter.user_data][1]
|
||||
val = self.get_value_from_handle(handle, col)
|
||||
#print 'val is', val, type(val)
|
||||
if col == self._tooltip_column:
|
||||
return val
|
||||
|
@ -172,7 +172,6 @@ class PlaceTreeView(PlaceBaseView):
|
||||
<toolitem action="Remove"/>
|
||||
<toolitem action="Merge"/>
|
||||
<separator/>
|
||||
<toolitem action="MapsList"/>
|
||||
</placeholder>
|
||||
</toolbar>
|
||||
<popup name="Popup">
|
||||
@ -204,28 +203,34 @@ class PlaceTreeView(PlaceBaseView):
|
||||
level1 = level2 = level3 = ""
|
||||
if len(pathlist) == 1:
|
||||
path = pathlist[0]
|
||||
node = model.on_get_iter(path)
|
||||
value = model.on_get_value(node, 0)
|
||||
|
||||
if len(path) == 1:
|
||||
level[0] = node.name
|
||||
elif len(path) == 2:
|
||||
level[1] = node.name
|
||||
parent = model.on_iter_parent(node)
|
||||
level[0] = parent.name
|
||||
elif len(path) == 3:
|
||||
level[2] = node.name
|
||||
parent = model.on_iter_parent(node)
|
||||
level[1] = parent.name
|
||||
parent = model.on_iter_parent(parent)
|
||||
level[0] = parent.name
|
||||
else:
|
||||
parent = model.on_iter_parent(node)
|
||||
level[2] = parent.name
|
||||
parent = model.on_iter_parent(parent)
|
||||
level[1] = parent.name
|
||||
parent = model.on_iter_parent(parent)
|
||||
level[0] = parent.name
|
||||
suc, node = model.do_get_iter(path)
|
||||
if suc:
|
||||
noden = model.get_node_from_iter(node)
|
||||
if len(path) == 1:
|
||||
level[0] = noden.name
|
||||
elif len(path) == 2:
|
||||
level[1] = noden.name
|
||||
suc, parent = model.do_iter_parent(node)
|
||||
parentn = model.get_node_from_iter(parent)
|
||||
level[0] = parentn.name
|
||||
elif len(path) == 3:
|
||||
level[2] = noden.name
|
||||
suc, parent = model.do_iter_parent(node)
|
||||
parentn = model.get_node_from_iter(parent)
|
||||
level[1] = parentn.name
|
||||
suc, parent = model.do_iter_parent(parent)
|
||||
parentn = model.get_node_from_iter(parent)
|
||||
level[0] = parentn.name
|
||||
else:
|
||||
suc, parent = model.do_iter_parent(node)
|
||||
parentn = model.get_node_from_iter(parent)
|
||||
level[2] = parentn.name
|
||||
suc, parent = model.do_iter_parent(parent)
|
||||
parentn = model.get_node_from_iter(parent)
|
||||
level[1] = parentn.name
|
||||
suc, parent = model.do_iter_parent(parent)
|
||||
parentn = model.get_node_from_iter(parent)
|
||||
level[0] = parentn.name
|
||||
|
||||
for ind in [0, 1, 2]:
|
||||
if level[ind] and level[ind] == COUNTRYLEVELS['default'][ind+1]:
|
||||
|
Loading…
Reference in New Issue
Block a user