Node properties and navigation

Home Forums cherrytree Node properties and navigation

This topic contains 6 replies, has 2 voices, and was last updated by  acry 1 month ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #125000

    JackR1
    Member

    Hello,
    I am using Cherrytree ver 0.38.4 running in Mint 17.3 and I am wondering:
    1) Is there a navigational aid (shortcut key or menu) to move to the parent node of the current node? KeepNote has this feature.
    2) Is there a way to display the path to the current node say in the Node Properties or as a pop up over the node? Currently when you show the Node Properties (in the Change Node Properties) it does not show a node’s full properties (no path to root).
    3) It is nice to see buttons to create node as a sub-node or as a sibling node. A button to display the path would be a nice addition. At the moment in my rather large tree with many sub-levels, it is quite a clumsy task to see the path.

    Thanks.

    Jack

    #125010

    acry
    Member

    To 1)
    ctrl+tab toggles activation of the node tree and the Text-Editor.
    While in Treeview-Widget you have somewhat control with the arrow/plus-minus/home-end and page up-down keys.
    arrow-Left should go to next parent.

    #125013

    acry
    Member

    Something like this?
    prev

    #125014

    JackR1
    Member

    Hi Thanks for that tip of Ctrl-Tab and in the Tree using the left arrow to go the parent.
    Is there another key to move down one level?

    Jack

    #125015

    JackR1
    Member

    Yes, that is what I would like to see. How did you cause Cherrytree to show that breadcrumb?

    Thanks.

    Jack

    #125016

    acry
    Member

    Mh,
    there __should__ be a a functionality to move to the next possbile node with childs in a tree.
    I coudn’t find it either.

    Showing the node path is afaik not possible with right now.
    I edited the core.py modules method:
    def update_node_name_header(self):

    to show the path instead of Nodes Title.
    I am not really great in Python2 and PyGTK2 but I modified the method to show all titles of the path not just of the current node.

    My Code for that is:

    	path = self.treestore.get_path(self.curr_tree_iter)
            count = len(path)
            x = 0
            sep = " >> "
            val = ""
            pathname = []
            for i in path:
                if x == 0:
                    citer = self.treestore.get_iter(path[0])
                else:
                    citer = self.treestore.get_iter(path[0:x + 1])
                val = self.treestore.get_value(citer, 0)
                pathname.append(val)
                if count > 1 and x < count - 1:
                    pathname.append(sep)
                x = x + 1
            print
            print pathname
            path_titles = ''.join(pathname)

    citer is current iterator, which is like a cursor in sqlite to the current selected “Item”.

    I can supply a patch or commit to git if needed.
    Personally I think showing the path in the head label over the TextView is an option which could be toggled. Another good option is, like you suggested, in the node properties dialog.

    Atm I work on Drag and Drop to implement dropping nodes internally and externally.
    Cheers,
    Cass aka. Acry

    #125018

    acry
    Member

    Sorry, the Code was not correct the val is taken of “column” 2 as the Treestore Row is defined as:
    ROW:
    0-icon_stock_id,
    1-name,
    2-buffer,
    3-unique_id,
    4-syntax_highlighting,
    5-node_sequence,
    6-tags,
    7-readonly,
    8-aux_icon_stock_id,
    9-custom_icon_id,
    10-weight,
    11-foreground,
    12-ts_creation,
    13-ts_lastsave

    The correct and more readable Version of the Code is:

    	path = self.treestore.get_path(self.curr_tree_iter)
            count = len(path)
            path_span = 1
            seperator = " >> "
            current_title = ""
            pathnames = []
            for pathes in path:
                if path_span == 0:
                    curr_tree_iter = self.treestore.get_iter(path[0])
                else:
                    curr_tree_iter = self.treestore.get_iter(path[0:path_span])
                current_title = self.treestore.get_value(curr_tree_iter, 1)
                pathnames.append(current_title)
                if count > 1 and path_span < count:
                    pathnames.append(seperator)
                path_span = path_span + 1
            path_titles = ''.join(pathnames)
            #print path_titles
Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.