Package libavg :: Module avg :: Class Node

Class Node


Base class for all elements in the avg tree.

Instance Methods
 
__eq__(...)
 
__hash__(...)
hash(x)
 
__init__(...)
Raises an exception This class cannot be instantiated from Python
 
__ne__(...)
abspos
getAbsPos(relpos)
Transforms a position in coordinates relative to the node to a position in window coordinates.
node
getParent()
Returns the container (AVGNode or DivNode) the node is in.
relpos
getRelPos(abspos)
Transforms a position in window coordinates to a position in coordinates relative to the node.
 
releaseEventCapture(cursorid)
Restores normal mouse operation after a call to setEventCapture().
 
setEventCapture(cursorid)
Sets up event capturing so that cursor events are sent to this node regardless of the cursor position.
 
setEventHandler(type, source, pyfunc)
Sets a callback function that is invoked whenever an event of the specified type from the specified source occurs.
None
unlink(kill)
Removes a node from it's parent container.

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties
  active
If this attribute is true, the node behaves as usual.
  id
A unique identifier that can be used to reference the node.
  opacity
A measure of the node's transparency.
  sensitive
A node only reacts to events if sensitive is true.

Inherited from object: __class__

Method Details

__hash__(...)
(Hashing function)

 

hash(x)

Overrides: object.__hash__
(inherited documentation)

__init__(...)
(Constructor)

 

Raises an exception This class cannot be instantiated from Python

Overrides: object.__init__

getAbsPos(relpos)

 

Transforms a position in coordinates relative to the node to a position in window coordinates.

Parameters:
  • relpos - Relative coordinate to transform.
Returns: abspos

getParent()

 

Returns the container (AVGNode or DivNode) the node is in. For the root node, returns None.

Returns: node

getRelPos(abspos)

 

Transforms a position in window coordinates to a position in coordinates relative to the node.

Parameters:
  • abspos - Absolute coordinate to transform.
Returns: relpos

releaseEventCapture(cursorid)

 

Restores normal mouse operation after a call to setEventCapture().

Parameters:
  • cursorid - The id of the tracker cursor to release (optional).

setEventCapture(cursorid)

 

Sets up event capturing so that cursor events are sent to this node regardless of the cursor position. cursorid is optional; if left out, the mouse cursor is captured. If not, events from a specific tracker cursor are captured. If the node doesn't handle the event, it propagates to its parent normally. This function is useful for the implementation of user interface elements such as scroll bars. Only one node can capture a cursor at any one time. Normal operation can be restored by calling releaseEventCapture().

Parameters:
  • cursorid - The id of the tracker cursor to capture (optional).

setEventHandler(type, source, pyfunc)

 

Sets a callback function that is invoked whenever an event of the specified type from the specified source occurs. This function is similar to the event handler node attributes (e.g. oncursordown). It is more specific since it takes the event source as a parameter and allows the use of any python callable as callback function.

Parameters:
  • type - One of the event types KEYUP, KEYDOWN, CURSORMOTION, CURSORUP, CURSORDOWN, CURSOROVER, CURSOROUT, RESIZE or QUIT.
  • source - MOUSE for mouse events, TOUCH for multitouch touch events, TRACK for multitouch track events or other tracking, NONE for keyboard events. Sources can be or'ed together to set a handler for several sources at once.
  • pyfunc - The python callable to invoke.

unlink(kill)

 

Removes a node from it's parent container. Equivalent to node.getParent().removeChild(node.getParent().indexOf(node)), except that if the node has no parent, unlink does nothing. Normally, unlink moves the node's textures back to the CPU and preserves event handlers. If kill=True, this step is skipped. Event handlers are reset, all textures are deleted and the href is reset to empty in this case, saving some time and making sure there are no references to the node left on the libavg side. kill should always be set to true if the node will not be used after the unlink.

Returns: None

Property Details

active

If this attribute is true, the node behaves as usual. If not, it is neither drawn nor does it react to events.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

id

A unique identifier that can be used to reference the node.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

opacity

A measure of the node's transparency. 0.0 is completely transparent, 1.0 is completely opaque. Opacity is relative to the parent node's opacity.

Get Method:
unreachable(...)
Set Method:
unreachable(...)

sensitive

A node only reacts to events if sensitive is true.

Get Method:
unreachable(...)
Set Method:
unreachable(...)