def do_iter_nth_child(self, parent, n): """ Gtk.TreeModel """ if parent is None: r = self.source elif parent.stamp != self.stamp: return (False, Gtk.TreeIter(stamp=-1)) else: r = self._get_user_data(parent) if self._row_has_child(r, n): return (True, self._create_iter(user_data=r[n])) return (False, Gtk.TreeIter(stamp=-1))
def do_iter_parent(self, child): """ Gtk.TreeModel """ if not self.is_tree or child is None or (child.stamp != self.stamp): return (False, Gtk.TreeIter(stamp=-1)) r = self._get_user_data(child) if r is None or r is self.source: return (False, Gtk.TreeIter(stamp=-1)) parent = r._parent or self.source if parent is self.source: return (False, Gtk.TreeIter(stamp=-1)) return (True, self._create_iter(user_data=parent))
def do_get_iter(self, path): """ Gtk.TreeModel """ indices = path.get_indices() r = self._get_row(indices) if r is None: return (False, Gtk.TreeIter(stamp=-1)) return (True, self._create_iter(user_data=r))
def _create_iter(self, user_data): it = Gtk.TreeIter() it.stamp = self.stamp self._set_user_data(it, user_data) return it