Source code for umbra.components.addons.traceUi.nodes

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
**nodes.py**

**Platform:**
	Windows, Linux, Mac Os X.

**Description:**
	This module defines the :class:`umbra.components.factory.traceUi.traceUi.TraceUi`
	Component Interface class nodes.

**Others:**

"""

#**********************************************************************************************************************
#***	External imports.
#**********************************************************************************************************************
from PyQt4.QtCore import Qt

#**********************************************************************************************************************
#***	Internal imports.
#**********************************************************************************************************************
import foundations.exceptions
import foundations.verbose
import foundations.trace
import umbra.ui.nodes

#**********************************************************************************************************************
#***	Module attributes.
#**********************************************************************************************************************
__author__ = "Thomas Mansencal"
__copyright__ = "Copyright (C) 2008 - 2013 - Thomas Mansencal"
__license__ = "GPL V3.0 - http://www.gnu.org/licenses/"
__maintainer__ = "Thomas Mansencal"
__email__ = "thomas.mansencal@gmail.com"
__status__ = "Production"

__all__ = ["LOGGER", "ModuleNode"]

LOGGER = foundations.verbose.installLogger()

#**********************************************************************************************************************
#***	Module classes and definitions.
#**********************************************************************************************************************
[docs]class ModuleNode(umbra.ui.nodes.GraphModelNode): """ This class factory defines :class:`umbra.components.factory.traceUi.traceUi.TraceUi` Component Interface class **Module** node. """ __family = "ModuleNode" def __init__(self, module=None, name=None, parent=None, children=None, roles=None, nodeFlags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled), attributesFlags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled), **kwargs): """ .. Sphinx: Statements updated for auto-documentation purpose. :param module: Module. ( Module ) :param name: Node name. ( String ) :param parent: Node parent. ( GraphModelNode ) :param children: Children. ( List ) :param roles: Roles. ( Dictionary ) :param nodeFlags: Node flags. ( Integer ) :param attributesFlags: Attributes flags. ( Integer ) :param \*\*kwargs: Keywords arguments. ( \*\* ) """ LOGGER.debug("> Initializing '{0}()' class.".format(self.__class__.__name__)) umbra.ui.nodes.GraphModelNode.__init__(self, name, parent, children, roles, nodeFlags, **kwargs) # --- Setting class attributes. --- self.__module = module ModuleNode.__initializeNode(self, attributesFlags) #****************************************************************************************************************** #*** Attributes properties. #****************************************************************************************************************** @property def module(self): """ This method is the property for **self.__module** attribute. :return: self.__module. ( Object ) """ return self.__module @module.setter #*** Sphinx: Decorator commented for auto-documentation purpose. @foundations.exceptions.handleExceptions(foundations.exceptions.ProgrammingError) def module(self, value): """ This method is the setter method for **self.__module** attribute. :param value: Attribute value. ( Object ) """ raise foundations.exceptions.ProgrammingError( "{0} | '{1}' attribute is read only!".format(self.__class__.__name__, "module")) @module.deleter #*** Sphinx: Decorator commented for auto-documentation purpose. @foundations.exceptions.handleExceptions(foundations.exceptions.ProgrammingError)
[docs] def module(self): """ This method is the deleter method for **self.__module** attribute. """ raise foundations.exceptions.ProgrammingError( "{0} | '{1}' attribute is not deletable!".format(self.__class__.__name__, "module")) #****************************************************************************************************************** #*** Class methods. #******************************************************************************************************************
def __initializeNode(self, attributesFlags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled)): """ This method initializes the node. :param attributesFlags: Attributes flags. ( Integer ) """ self["traced"] = umbra.ui.nodes.GraphModelAttribute(name="traced", value=foundations.trace.isTraced(self.__module), flags=attributesFlags) self.updateNodeAttributes()
[docs] def updateNodeAttributes(self, attributesFlags=int(Qt.ItemIsSelectable | Qt.ItemIsEnabled)): """ This method updates the Node attributes. :param attributesFlags: Attributes flags. ( Integer ) :return: Method success. ( Boolean ) """ self.traced.value = foundations.trace.isTraced(self.__module) self.traced.roles[Qt.DisplayRole] = foundations.strings.encode(self.traced.value).title()