:right-sidebar: True TreePath =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 Please do not use it in newly written code .. class:: TreePath(*args, **kwargs) :no-contents-entry: An opaque structure representing a path to a row in a model. Constructors ------------ .. rst-class:: interim-class .. class:: TreePath :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.TreePath Creates a new ``GtkTreePath`` This refers to a row. .. deprecated:: 4.10 Please do not use it in newly written code .. classmethod:: new_first() -> ~gi.repository.Gtk.TreePath Creates a new ``GtkTreePath``\. The string representation of this path is “0”. .. deprecated:: 4.10 Please do not use it in newly written code .. classmethod:: new_from_indices(indices: list[int]) -> ~gi.repository.Gtk.TreePath Creates a new path with ``first_index`` and ``varargs`` as indices. .. deprecated:: 4.10 Please do not use it in newly written code :param indices: .. classmethod:: new_from_string(path: str) -> ~gi.repository.Gtk.TreePath | None Creates a new ``GtkTreePath`` initialized to ``path``\. ``path`` is expected to be a colon separated list of numbers. For example, the string “10:4:0” would create a path of depth 3 pointing to the 11th child of the root node, the 5th child of that 11th child, and the 1st child of that 5th child. If an invalid path string is passed in, :const:`None` is returned. .. deprecated:: 4.10 Please do not use it in newly written code :param path: The string representation of a path Methods ------- .. rst-class:: interim-class .. class:: TreePath :no-index: .. method:: append_index(index_: int) -> None Appends a new index to a path. As a result, the depth of the path is increased. .. deprecated:: 4.10 Please do not use it in newly written code :param index_: the index .. method:: compare(b: ~gi.repository.Gtk.TreePath) -> int Compares two paths. If ``a`` appears before ``b`` in a tree, then -1 is returned. If ``b`` appears before ``a``\, then 1 is returned. If the two nodes are equal, then 0 is returned. .. deprecated:: 4.10 Please do not use it in newly written code :param b: a ``GtkTreePath`` to compare with .. method:: down() -> None Moves ``path`` to point to the first child of the current path. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: free() -> None Frees ``path``\. If ``path`` is :const:`None`, it simply returns. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_depth() -> int Returns the current depth of ``path``\. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: get_indices() -> list[int] | None Returns the current indices of ``path``\. This is an array of integers, each representing a node in a tree. This value should not be freed. The length of the array can be obtained with :func:`~gi.repository.Gtk.TreePath.get_depth`. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: is_ancestor(descendant: ~gi.repository.Gtk.TreePath) -> bool Returns :const:`True` if ``descendant`` is a descendant of ``path``\. .. deprecated:: 4.10 Please do not use it in newly written code :param descendant: another ``GtkTreePath`` .. method:: is_descendant(ancestor: ~gi.repository.Gtk.TreePath) -> bool Returns :const:`True` if ``path`` is a descendant of ``ancestor``\. .. deprecated:: 4.10 Please do not use it in newly written code :param ancestor: another ``GtkTreePath`` .. method:: next() -> None Moves the ``path`` to point to the next node at the current depth. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: prepend_index(index_: int) -> None Prepends a new index to a path. As a result, the depth of the path is increased. .. deprecated:: 4.10 Please do not use it in newly written code :param index_: the index .. method:: prev() -> bool Moves the ``path`` to point to the previous node at the current depth, if it exists. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: to_string() -> str | None Generates a string representation of the path. This string is a “:” separated list of numbers. For example, “4:10:0:3” would be an acceptable return value for this string. If the path has depth 0, :const:`None` is returned. .. deprecated:: 4.10 Please do not use it in newly written code .. method:: up() -> bool Moves the ``path`` to point to its parent node, if it has a parent. .. deprecated:: 4.10 Please do not use it in newly written code