Esempio n. 1
0
    def __str__( self, indent = 0,
                 headerLastIndentUnit=Configurable.indentUnit ):
        global msg  # to print some info depending on output level
        indentStr = indent * Configurable.indentUnit
        # print header
        title = "%s/%s" % ( self.__class__.__name__, self._name )

        # print line to easily see start-of-configurable
        if indent > 0:
            headerIndent = (indent-1)*Configurable.indentUnit \
                           + headerLastIndentUnit
        else:
            headerIndent = ''

        rep = Configurable._printHeader( headerIndent, title )
        rep += os.linesep

        # print own properties
        props = self.getProperties()
        if not props:
            #rep += indentStr + '|-<no output-item-list>' + os.linesep
            rep += indentStr + '| ' + os.linesep
        else:
            # get property name with
            nameWidth = 0
            for p in props.keys():
                nameWidth=max(nameWidth,len(p))
            for p, v in props.items():
                # start with indent and property name
                prefix = indentStr + '|-%-*s' % (nameWidth,p)
                # add memory address for debugging (not for defaults)
                if msg.isEnabledFor( logging.DEBUG ):
                    address = ' @%11s' % hex(id(v))
                    prefix += address
                # add value and default
                strVal = repr(v)
                # add the value
                line = prefix + ' = ' + strVal
                # add the line to the total string
                rep += line + os.linesep
        # print configurables + their properties, or loop over sequence
        for cfg in self.allChildren():
            rep += cfg.__str__( indent + 1, '|=' ) + os.linesep

        # print line to easily see end-of-configurable. Note: No linesep!
        rep += Configurable._printFooter( indentStr, title )
        return rep
Esempio n. 2
0
    def __str__( self, indent = 0,
                 headerLastIndentUnit=Configurable.indentUnit ):
        global msg  # to print some info depending on output level
        indentStr = indent * Configurable.indentUnit
        # print header
        title = "%s/%s" % ( self.__class__.__name__, self._name )

        # print line to easily see start-of-configurable
        if indent > 0:
            headerIndent = (indent-1)*Configurable.indentUnit \
                           + headerLastIndentUnit
        else:
            headerIndent = ''

        rep = Configurable._printHeader( headerIndent, title )
        rep += os.linesep

        # print own properties
        props = self.getProperties()
        if not props:
            #rep += indentStr + '|-<no output-item-list>' + os.linesep
            rep += indentStr + '| ' + os.linesep
        else:
            # get property name with
            nameWidth = 0
            for p in props.keys():
                nameWidth=max(nameWidth,len(p))
            for p, v in props.items():
                # start with indent and property name
                prefix = indentStr + '|-%-*s' % (nameWidth,p)
                # add memory address for debugging (not for defaults)
                if msg.isEnabledFor( logging.DEBUG ):
                    address = ' @%11s' % hex(id(v))
                    prefix += address
                # add value and default
                strVal = repr(v)
                # add the value
                line = prefix + ' = ' + strVal
                # add the line to the total string
                rep += line + os.linesep
        # print configurables + their properties, or loop over sequence
        for cfg in self.allChildren():
            rep += cfg.__str__( indent + 1, '|=' ) + os.linesep

        # print line to easily see end-of-configurable. Note: No linesep!
        rep += Configurable._printFooter( indentStr, title )
        return rep
Esempio n. 3
0
    def __str__( self, indent = 0,
                 headerLastIndentUnit=Configurable.indentUnit ):
        
        global msg  # to print some info depending on output level
        indentStr = indent * Configurable.indentUnit
        # print header
        title = "%s/%s" % ( self.__class__.__name__, self._name )

        # print line to easily see start-of-configurable
        if indent > 0:
            headerIndent = (indent-1)*Configurable.indentUnit \
                           + headerLastIndentUnit
        else:
            headerIndent = ''

        rep = Configurable._printHeader( headerIndent, title )
        rep += os.linesep

        rep += self._items.__str__( indent + 1, '|=' ) + os.linesep
        # print line to easily see end-of-configurable. Note: No linesep!
        rep += Configurable._printFooter( indentStr, title )
        return rep
Esempio n. 4
0
    def __str__( self, indent = 0,
                 headerLastIndentUnit=Configurable.indentUnit ):
        
        global msg  # to print some info depending on output level
        indentStr = indent * Configurable.indentUnit
        # print header
        title = "%s/%s" % ( self.__class__.__name__, self._name )

        # print line to easily see start-of-configurable
        if indent > 0:
            headerIndent = (indent-1)*Configurable.indentUnit \
                           + headerLastIndentUnit
        else:
            headerIndent = ''

        rep = Configurable._printHeader( headerIndent, title )
        rep += os.linesep

        rep += self._items.__str__( indent + 1, '|=' ) + os.linesep
        # print line to easily see end-of-configurable. Note: No linesep!
        rep += Configurable._printFooter( indentStr, title )
        return rep