Package pyrobot :: Package gui :: Package widgets :: Module tree :: Class Node
[frames | no frames]

Class Node

Known Subclasses:
ClickNode

Tree helper class that's instantiated for each element in the tree.  It
has several useful attributes:
parent_node     - immediate parent node
id              - id assigned at creation
expanded_icon   - image displayed when folder is expanded to display
                  children
collapsed_icon  - image displayed when node is not a folder or folder is
                  collapsed.
parent_widget   - reference to tree widget that contains node.
expandable_flag - is true when node is a folder that may be expanded or
                  collapsed.
expanded_flag   - true to indicate node is currently expanded.
h_line          - canvas line to left of node image.
v_line          - canvas line below node image that connects children.
indic           - expand/collapse canvas image.
label           - canvas text label
symbol          - current canvas image

Please note that methods prefixed PVT_* are not meant to be used by
client programs.

Method Summary
  __init__(self, parent_node, id, collapsed_icon, x, y, parent_widget, expanded_icon, label, expandable_flag)
Create node and initialize it.
  children(self)
Return list of node's children...
  collapse(self)
Collapse node if possible...
  delete(self, me_too)
Delete node from tree.
  dnd_end(self, target, event)
Notification that dnd processing has been ended.
  expand(self)
Expand node if possible...
  expandable(self)
Returns true if node can be expanded (i.e.
  expanded(self)
Returns true if node is currently expanded, false otherwise...
  full_id(self)
Return list of IDs of all parents and node ID...
  get_label(self)
Return string containing text of current label...
  insert_after(self, nodes)
Insert list of nodes as siblings after this node.
  insert_before(self, nodes)
Insert list of nodes as siblings before this node.
  insert_children(self, nodes)
Insert list of nodes as children of this node.
  next_sib(self)
Return node's next sibling (the child immediately below it)...
  next_visible(self)
Return next lower visible node...
  parent(self)
Return node's parent node...
  prev_sib(self)
Return node's previous sibling (the child immediately above it)...
  prev_visible(self)
Return next higher visible node...
  PVT_cleanup_lines(self)
Resize connecting lines...
  PVT_click(self, event)
Handle mouse clicks by kicking off possible drag'n'drop...
  PVT_delete_subtree(self)
Recursively delete subtree & clean up cyclic references to make...
  PVT_enter(self, event)
detect mouse hover for drag'n'drop...
  PVT_find(self, search)
Used by searching functions...
  PVT_insert(self, nodes, pos, below)
Create and insert new children.
  PVT_last(self)
Return bottom-most node in subtree...
  PVT_set_state(self, state)
Common code forexpanding/collapsing folders.
  PVT_tag_move(self, dist)
Move everything below current icon, to make room for subtree using the Disney magic of item tags.
  PVT_unbind_all(self)
Unbind callbacks so node gets garbage-collected.
  PVT_update_scrollregion(self)
Update scroll region for new size...
  set_collapsed_icon(self, icon)
Set node's collapsed image...
  set_expanded_icon(self, icon)
Set node's expanded image...
  set_label(self, label)
Set current text label...
  toggle_state(self)
Toggle node's state between expanded and collapsed, if possible...

Method Details

__init__(self, parent_node, id, collapsed_icon, x, y, parent_widget=None, expanded_icon=None, label=None, expandable_flag=0)
(Constructor)

Create node and initialize it.  This also displays the node at the
given position on the canvas, and binds mouseclicks.

children(self)

Return list of node's children

collapse(self)

Collapse node if possible

delete(self, me_too=1)

Delete node from tree. ("me_too" is a hack not to be used by
external code, please!)

dnd_end(self, target, event)

Notification that dnd processing has been ended. It DOES NOT imply
that we've been dropped somewhere useful, we could have just been
dropped into deep space and nothing happened to any data structures,
or it could have been just a plain mouse-click w/o any dragging.

expand(self)

Expand node if possible

expandable(self)

Returns true if node can be expanded (i.e. if it's a folder)

expanded(self)

Returns true if node is currently expanded, false otherwise

full_id(self)

Return list of IDs of all parents and node ID

get_label(self)

Return string containing text of current label

insert_after(self, nodes)

Insert list of nodes as siblings after this node.  Call parent
node's add_node() function to generate the list of nodes.

insert_before(self, nodes)

Insert list of nodes as siblings before this node.  Call parent
node's add_node() function to generate the list of nodes.

insert_children(self, nodes)

Insert list of nodes as children of this node.  Call node's
add_node() function to generate the list of nodes.

next_sib(self)

Return node's next sibling (the child immediately below it)

next_visible(self)

Return next lower visible node

parent(self)

Return node's parent node

prev_sib(self)

Return node's previous sibling (the child immediately above it)

prev_visible(self)

Return next higher visible node

PVT_cleanup_lines(self)

Resize connecting lines

PVT_click(self, event)

Handle mouse clicks by kicking off possible drag'n'drop
processing

PVT_delete_subtree(self)

Recursively delete subtree & clean up cyclic references to make
garbage collection happy

PVT_enter(self, event)

detect mouse hover for drag'n'drop

PVT_find(self, search)

Used by searching functions

PVT_insert(self, nodes, pos, below)

Create and insert new children. "nodes" is list previously created
via calls to add_list(). "pos" is index in the list of children where
the new nodes are inserted. "below" is node which new children should
appear immediately below.

PVT_last(self)

Return bottom-most node in subtree

PVT_set_state(self, state)

Common code forexpanding/collapsing folders. It's not re-entrant,
and there are certain cases in which we can be called again before
we're done, so we use a mutex.

PVT_tag_move(self, dist)

Move everything below current icon, to make room for subtree using
the Disney magic of item tags.  This is the secret of making
everything as fast as it is.

PVT_unbind_all(self)

Unbind callbacks so node gets garbage-collected. This wasn't easy
to figure out the proper way to do this.  See also tag_bind() for the
Tree widget itself.

PVT_update_scrollregion(self)

Update scroll region for new size

set_collapsed_icon(self, icon)

Set node's collapsed image

set_expanded_icon(self, icon)

Set node's expanded image

set_label(self, label)

Set current text label

toggle_state(self)

Toggle node's state between expanded and collapsed, if possible

Generated by Epydoc 2.1 on Mon Jul 25 01:39:26 2005 http://epydoc.sf.net