Remove needless use of handles in FlatBaseModel.do_iter_next
This commit is contained in:
parent
48eb2842ee
commit
d4a99d8488
@ -318,18 +318,14 @@ class FlatNodeMap(object):
|
|||||||
handle = handle.decode('utf-8')
|
handle = handle.decode('utf-8')
|
||||||
return handle
|
return handle
|
||||||
|
|
||||||
def find_next_handle(self, iter):
|
def iter_next(self, iter):
|
||||||
"""
|
"""
|
||||||
Finds the next handle based off the passed handle. This is accomplished
|
Increments the iter y finding the index associated with the iter,
|
||||||
by finding the index associated with the iter, adding or substracting
|
adding or substracting one.
|
||||||
one to find the next index, then finding the handle associated with
|
|
||||||
that.
|
|
||||||
False is returned if no next handle
|
False is returned if no next handle
|
||||||
True, handle tuple otherwise
|
|
||||||
|
|
||||||
:param handle: the key of the object for which the next handle shown
|
:param iter: Gtk.TreeModel iterator
|
||||||
in the treeview is needed
|
:param type: Gtk.TreeIter
|
||||||
:param type: an object handle
|
|
||||||
"""
|
"""
|
||||||
index = iter.user_data
|
index = iter.user_data
|
||||||
if index is None:
|
if index is None:
|
||||||
@ -346,11 +342,10 @@ class FlatNodeMap(object):
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
index += 1
|
index += 1
|
||||||
|
if index >= len(self._index2hndl):
|
||||||
try:
|
|
||||||
return True, self._index2hndl[index][1]
|
|
||||||
except IndexError:
|
|
||||||
return False
|
return False
|
||||||
|
iter.user_data = index
|
||||||
|
return True
|
||||||
|
|
||||||
def get_first_iter(self):
|
def get_first_iter(self):
|
||||||
"""
|
"""
|
||||||
@ -795,14 +790,14 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
col is the model column that is needed, not the visible column!
|
col is the model column that is needed, not the visible column!
|
||||||
"""
|
"""
|
||||||
#print ('do_get_val', iter, iter.user_data, col)
|
#print ('do_get_val', iter, iter.user_data, col)
|
||||||
ud = iter.user_data
|
index = iter.user_data
|
||||||
if ud is None:
|
if index is None:
|
||||||
##GTK3: user data may only be an integer, we store the index
|
##GTK3: user data may only be an integer, we store the index
|
||||||
##PROBLEM: pygobject 3.8 stores 0 as None, we need to correct
|
##PROBLEM: pygobject 3.8 stores 0 as None, we need to correct
|
||||||
## when using user_data for that!
|
## when using user_data for that!
|
||||||
##upstream bug: https://bugzilla.gnome.org/show_bug.cgi?id=698366
|
##upstream bug: https://bugzilla.gnome.org/show_bug.cgi?id=698366
|
||||||
ud = 0
|
index = 0
|
||||||
handle = self.node_map._index2hndl[ud][1]
|
handle = self.node_map._index2hndl[index][1]
|
||||||
val = self._get_value(handle, col)
|
val = self._get_value(handle, col)
|
||||||
#print 'val is', val, type(val)
|
#print 'val is', val, type(val)
|
||||||
|
|
||||||
@ -822,13 +817,7 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel):
|
|||||||
Sets iter to the next node at this level of the tree
|
Sets iter to the next node at this level of the tree
|
||||||
See Gtk.TreeModel
|
See Gtk.TreeModel
|
||||||
"""
|
"""
|
||||||
#print 'do_iter_next', iter, iter.user_data
|
return self.node_map.iter_next(iter)
|
||||||
handle = self.node_map.find_next_handle(iter)
|
|
||||||
if handle:
|
|
||||||
iter.user_data = self.node_map._hndl2index[handle[1]]
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def do_iter_children(self, iterparent):
|
def do_iter_children(self, iterparent):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user