class documentation

class PageTreeStoreBase(GenericTreeModel, Gtk.TreeDragSource, Gtk.TreeDragDest): (source)

Known subclasses: zim.plugins.pageindex.PageTreeStore, zim.plugins.tags.DuplicatePageTreeStore

View In Hierarchy

Custom gtk TreeModel that is integrated closely with the Index object of the notebook. This model is mostly an API layer translating between the Gtk.TreeView and the zim Index interfaces. It fetches data on the fly when requested and only keeps a very limited cache in memory. This allows scaling to very large notebooks.

This custom model is based on GenericTreeModel which takes care of the C library wrapper. See the documentation there to get the fine details of the API.

Be aware that in this interface there are two classes both referred to as "paths". The first is the gtk TreePath (which is in fact just a tuple of integers, without a propr class) and the second is zim.notebook.Path. When a gtk TreePath is intended the argument is explicitly called "treepath", while arguments called "path" refer to a zim Path.

For all the methods with a name starting with on_ the "iter" argument is a MyTreeIter. The GenericTreeModel in turn wraps these in Gtk.TreeIter object. So e.g. the implementation of get_iter() calls on_get_iter() and wraps the MyTreeIter object into a Gtk.TreeIter.

Method __init__ Initialize. Make sure to call this from derived classes if overridden.
Method flush_cache Undocumented
Method get_indexpath Get an PageIndexRecord for a Gtk.TreeIter
Method on_get_column_type Overridable.
Method on_get_flags Overridable.
Method on_get_iter Returns an MyTreeIter for a gtk TreePath or None
Method on_get_n_columns Overridable.
Method on_get_path Returns a gtk TreePath for an indexpath
Method on_get_value Overridable.
Method on_iter_children Returns an PageIndexRecord for the first child below path or None. If path is None returns the PageIndexRecord for first top level item.
Method on_iter_has_child Returns True if PageIndexRecord for iter has children
Method on_iter_n_children Returns the number of children in a namespace. When iter is None the number of pages in the root namespace is given.
Method on_iter_next Returns the PageIndexRecord for the next row on the same level or None
Method on_iter_nth_child Returns the nth child or None. If iter is None the nth item in the root namespace is returned.
Method on_iter_parent Returns an indexpath for parent node or None
Method set_current_page Set the current open page to highlight it in the index. @param path: the Path that is currently open, or None to unset
Constant COLUMN_TYPES Undocumented
Instance Variable current_page Undocumented
Method _emit_page_changes Undocumented
Instance Variable _flush_scheduled Undocumented

Inherited from GenericTreeModel:

Method create_tree_iter Create a Gtk.TreeIter instance with the given user_data specific for this model.
Method do_get_column_type Internal method.
Method do_get_flags Internal method.
Method do_get_iter Internal method.
Method do_get_n_columns Internal method.
Method do_get_path Internal method.
Method do_get_value Internal method.
Method do_iter_children Internal method.
Method do_iter_has_child Internal method.
Method do_iter_n_children Internal method.
Method do_iter_next Internal method.
Method do_iter_nth_child Internal method.
Method do_iter_parent Internal method.
Method do_ref_node Undocumented
Method do_unref_node Undocumented
Method get_user_data Get the user_data associated with the given TreeIter.
Method invalidate_iter Clear user data and its reference from the iter and this model.
Method invalidate_iters This method invalidates all TreeIter objects associated with this custom tree model and frees their locally pooled references.
Method iter_depth_first Depth-first iteration of the entire TreeModel yielding the python nodes.
Method iter_is_valid :Returns: True if the gtk.TreeIter specified by iter is valid for the custom tree model.
Method on_ref_node Undocumented
Method on_unref_node Undocumented
Method row_deleted Notify the model a row has been deleted.
Method set_user_data Applies user_data and stamp to the given iter.
Class Variable leak_references Undocumented
Instance Variable stamp Undocumented
Method _create_tree_iter Internal creation of a (bool, TreeIter) pair for returning directly back to the view interfacing with this model.
Instance Variable _held_refs Undocumented
def flush_cache(self): (source)

Undocumented

def get_indexpath(self, treeiter): (source)
Get an PageIndexRecord for a Gtk.TreeIter
Parameters
treeitera Gtk.TreeIter
Returns
an PageIndexRecord object
def on_get_iter(self, treepath): (source)
Returns an MyTreeIter for a gtk TreePath or None
def on_get_path(self, iter): (source)
Returns a gtk TreePath for an indexpath
def on_iter_children(self, iter): (source)
Returns an PageIndexRecord for the first child below path or None. If path is None returns the PageIndexRecord for first top level item.
def on_iter_has_child(self, iter): (source)
Returns True if PageIndexRecord for iter has children
def on_iter_n_children(self, iter): (source)
Returns the number of children in a namespace. When iter is None the number of pages in the root namespace is given.
def on_iter_next(self, iter): (source)
Returns the PageIndexRecord for the next row on the same level or None
def on_iter_nth_child(self, iter, n): (source)
Returns the nth child or None. If iter is None the nth item in the root namespace is returned.
def on_iter_parent(self, iter): (source)
Returns an indexpath for parent node or None
def set_current_page(self, path): (source)
Set the current open page to highlight it in the index.
Parameters
paththe Path that is currently open, or None to unset
COLUMN_TYPES = (source)

Undocumented

Value
(GObject.TYPE_STRING,
 GObject.TYPE_PYOBJECT,
 GObject.TYPE_BOOLEAN,
 Pango.Style,
 GObject.TYPE_INT,
 GObject.TYPE_STRING,
 GObject.TYPE_STRING)
current_page = (source)

Undocumented

def _emit_page_changes(self, path): (source)

Undocumented

_flush_scheduled: bool = (source)

Undocumented