<commit_before>Base Node Classes
=================

This section describes the base classes for all node classes that libavg provides. 

.. automodule:: libavg.avg
    :no-members:

    .. inheritance-diagram:: Node VisibleNode
        :parts: 1

    To be rendered, a :py:class:`Node` must be part of a scene graph. Scene graphs are 
    trees of :py:class:`Node` objects associated with a :py:class:`Canvas`. A
    :py:class:`CanvasNode` is at the root of each scene graph. Scene graphs are pure tree
    structures, so each :py:class:`Node` only has one parent node. Nodes that are not 
    linked to a canvas are not rendered. Any media that these nodes need are loaded from 
    disk, however.

    libavg :py:class:`Node` classes make heavy use of inheritance. Concepts like 
    :py:attr:`id`, :py:attr:`position` and :py:attr:`opacity` are defined in base classes
    and can be used in any of the subclasses. 
    
    .. note::

        To reduce redundancy in the reference,
        inherited methods and attributes are not mentioned in the derived class 
        documentation - follow the link to the base class to access them. This also 
        applies to constructor parameters: When constructing an object of a derived class,
        constructor parameters of the base classes are also accepted.
        
    There are several ways of constructing a
    node. The reference documentation follows the python constructor syntax. The
    parameters remain the same in all syntactic variations, however. The options for 
    construction are as follows:

        **Use the standard python constructor**:
            Nodes can be created using a standard python constructor. As an example::

                node = ImageNode(id="background", href="sunset.png", pos=(0,0), 
                        parent=rootNode)

            Parameters to a node constructor are always named parameters. Nodes never have
            positional constructor parameters.

        **Use** :py:meth:`Player.createNode`:
            There are two ways to create a node using createNode::

                node = player.createNode("image", 
                        {"id":"background", "href":"sunset.png", "pos":(0,0), 
                         "parent":rootNode})

            and::

                node = player.createNode(
                        """<image id="background" href="sunset.png" 
                                      pos="(0,0)"/>""")

            Using the second option, complete trees of nodes can be constructed in one
            statement.

        **Load it from an avg file**:
            Complete scene graphs for onscreen display can be loaded from disk using 
            :py:meth:`Player.loadFile`::

                root = player.loadFile("scene.avg")

        **Create a complete scene graph using inline xml**:
            :py:meth:`Player.loadString` allows using an avg-formatted xml string to 
            create a scene graph of nodes::

                root = player.loadString("""
                        <avg size="(800,600)">
                            <image id="background" href="sunset.png" 
                                      pos="(0,0)"/>
                        </avg>
                    """)

        The methods :py:meth:`Player.loadFile` and :py:meth:`Player.loadString` create 
        onscreen scene graphs. :py:meth:`Player.loadCanvasFile` and 
        :py:meth:`Player.loadCanvasString` are the equivalent methods for offscreen 
        canvases.

    .. autoclass:: Node([id: string, parent: DivNode=None])

        Base class for everything that can be put into an avg tree.

        .. py:attribute:: id

            A unique identifier that can be used to reference the node, for instance using
            :py:meth:`Player.getElementByID`. Read-only.

        .. py:attribute:: parent

            A :py:class:`DivNode` that the node will become a child of. Equivalent to 
            calling :py:meth:`DivNode.appendChild` directly after construction.

    .. autoclass:: VisibleNode([oncursormove, oncursorup, uncursordown, oncursorover, oncursorout, active=True, sensitive=True, opacity=1.0, parent])

        Base class for all elements in the avg tree that have a visual representation.
        All nodes except those derived from :py:class:`FXNode` are VisibleNodes.

        :param string oncursormove:

            Name of python function to call when a cursor moves.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param string oncursorup:

            Name of python function to call when an up event occurs.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param string oncursordown:

            Name of python function to call when a down event occurs.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param string oncursorover:

            Name of python function to call when a cursor enters the node.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param string oncursorout:

            Name of python function to call when a cursor leaves the node.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param DivNode parent:

            A :py:class:`DivNode` that the newly constructed Node should be appended
            to.

        .. py:attribute:: active

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

        .. py:attribute:: opacity

            A measure of the node's transparency. 0.0 is completely
            transparent, 1.0 is completely opaque. Opacity is relative to<commit_msg>VisibleNode/Node doc update.<commit_after>Base Node Classes
=================

This section describes the base classes for all node classes that libavg provides. 

.. automodule:: libavg.avg
    :no-members:

    .. inheritance-diagram:: Node VisibleNode
        :parts: 1

    To be rendered, a :py:class:`Node` must be part of a scene graph. Scene graphs are 
    trees of :py:class:`Node` objects associated with a :py:class:`Canvas`. A
    :py:class:`CanvasNode` is at the root of each scene graph. Scene graphs are pure tree
    structures, so each :py:class:`Node` only has one parent node. Nodes that are not 
    linked to a canvas are not rendered. Any media that these nodes need are loaded from 
    disk, however.

    libavg :py:class:`Node` classes make heavy use of inheritance. Concepts like 
    :py:attr:`id`, :py:attr:`position` and :py:attr:`opacity` are defined in base classes
    and can be used in any of the subclasses. 
    
    .. note::

        To reduce redundancy in the reference,
        inherited methods and attributes are not mentioned in the derived class 
        documentation - follow the link to the base class to access them. This also 
        applies to constructor parameters: When constructing an object of a derived class,
        constructor parameters of the base classes are also accepted.
        
    There are several ways of constructing a
    node. The reference documentation follows the python constructor syntax. The
    parameters remain the same in all syntactic variations, however. The options for 
    construction are as follows:

        **Use the standard python constructor**:
            Nodes can be created using a standard python constructor. As an example::

                node = ImageNode(id="background", href="sunset.png", pos=(0,0), 
                        parent=rootNode)

            Parameters to a node constructor are always named parameters. Nodes never have
            positional constructor parameters.

        **Use** :py:meth:`Player.createNode`:
            There are two ways to create a node using createNode::

                node = player.createNode("image", 
                        {"id":"background", "href":"sunset.png", "pos":(0,0), 
                         "parent":rootNode})

            and::

                node = player.createNode(
                        """<image id="background" href="sunset.png" 
                                      pos="(0,0)"/>""")

            Using the second option, complete trees of nodes can be constructed in one
            statement.

        **Load it from an avg file**:
            Complete scene graphs for onscreen display can be loaded from disk using 
            :py:meth:`Player.loadFile`::

                root = player.loadFile("scene.avg")

        **Create a complete scene graph using inline xml**:
            :py:meth:`Player.loadString` allows using an avg-formatted xml string to 
            create a scene graph of nodes::

                root = player.loadString("""
                        <avg size="(800,600)">
                            <image id="background" href="sunset.png" 
                                      pos="(0,0)"/>
                        </avg>
                    """)

        The methods :py:meth:`Player.loadFile` and :py:meth:`Player.loadString` create 
        onscreen scene graphs. :py:meth:`Player.loadCanvasFile` and 
        :py:meth:`Player.loadCanvasString` are the equivalent methods for offscreen 
        canvases.

    .. autoclass:: Node([oncursormove, oncursorup, uncursordown, oncursorover, oncursorout, id: string="", parent: DivNode=None, active=True, sensitive=True, opacity=1.0])

        Base class for everything that can be put into an avg tree.

        :param string oncursormove:

            Name of python function to call when a cursor moves.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param string oncursorup:

            Name of python function to call when an up event occurs.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param string oncursordown:

            Name of python function to call when a down event occurs.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param string oncursorover:

            Name of python function to call when a cursor enters the node.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        :param string oncursorout:

            Name of python function to call when a cursor leaves the node.

            .. deprecated:: 1.5
                Use :func:`connectEventHandler()` instead.

        .. py:attribute:: id

            A unique identifier that can be used to reference the node, for instance using
            :py:meth:`Player.getElementByID`. Read-only.

        .. py:attribute:: parent

            A :py:class:`DivNode` that the node will become a child of. Equivalent to 
            calling :py:meth:`DivNode.appendChild` directly after construction.

        .. py:attribute:: active

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

        .. py:attribute:: opacity

            A measure of the node's transparency. 0.0 is completely
            transparent, 1.0 is completely opaque. Opacity is relative to
{'fraction_non_alphanumeric': 0.08397418898612216, 'fraction_numerical': 0.005480420754883762, 'mean_word_length': 2.0694519804666305, 'pattern_counts': {'":': 8, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2937571', 'n_tokens_mistral': 2877, 'n_tokens_neox': 2626, 'n_words': 1150}