Example #1
0
def start_server(node_actions=None,
                 tree_style=None,
                 host="localhost",
                 port=8989):
    global DEFAULT_STYLE, DEFAULT_ACTIONS
    if node_actions:
        DEFAULT_ACTIONS = node_actions
    else:
        DEFAULT_ACTIONS = NodeActions()

    if tree_style:
        DEFAULT_STYLE = tree_style
    else:
        DEFAULT_STYLE = TreeStyle()

    run(host=host, port=port, server='cherrypy')
    def get_node_action(self):
        act = NodeActions()
        #act.add_action('Root here', self.show_action_root, self.run_action_root, None)
        act.add_action('Box Highlight', self.show_action_highlight, self.run_action_boxhighlight, None)
        act.add_action('Line Highlight', self.show_action_highlight, self.run_action_indvhighlight, None)
        #act.add_action('Change style', self.show_action_change_style, self.run_action_change_style, None)
        act.add_action('EOL link', self.show_eol_link, None, self.eol_link)
        act.add_action('Display picture', self.show_action_picture, self.run_action_picture, None)
        act.add_action('Hide picture', self.show_action_picture, self.run_clear_picture, None)
        act.add_action('Collapse', self.show_action_collapse, self.collapse, None)
        act.add_action('Expand', self.show_action_expand, self.expand, None)
        act.add_action('Swap children',self.show_action_swap,self.swap_branches,None)

        return act
    def get_node_action(self):
        act = NodeActions()
        #act.add_action('Root here', self.show_action_root, self.run_action_root, None)
        act.add_action("Add (remove) box", 3, self.show_action_highlight, self.run_action_boxhighlight, None)
        #act.add_action("Thick (thin) branch", 4, self.show_action_highlight, self.run_action_indvhighlight, None)
        #act.add_action('Change style', self.show_action_change_style, self.run_action_change_style, None)
        act.add_action("Read info page", 1, self.show_eol_link, None, self.eol_link)
        act.add_action("Add (remove) photo", 2, self.show_action_picture, self.run_action_picture, None)
        #act.add_action('Hide Picture', self.show_action_picture, self.run_clear_picture, None)
        #act.add_action('Change Picture', "Change photo", 5, self.show_action_picture, self.run_change_picture, None)
        act.add_action("Collapse subtree", 1, self.show_action_collapse, self.collapse, None)
        act.add_action("Expand subtree", 1, self.show_action_expand, self.expand, None)
        act.add_action("Rotate subtree", 2, self.show_action_swap,self.swap_branches,None)

        return act