Beispiel #1
0
    )

_styles.add(
    "caption",
    color = "#669900",
    margin_top = "%spt" % CAPTION_OFFSET,
    margin_bottom = "0pt",
    )

_styles.add(
    "command",
    color = "#669900",
    )

# The tag aliases for primary message XML.
_tagAliases = xmltextlayout.XmlMarkupTagAliases()
_tagAliases.add( "p", baseElement = "block" )
_tagAliases.add( "caption", baseElement = "block" )
_tagAliases.add( "command", baseElement = "inline" )


def layoutMessageXml( xmlMarkup, width, size, height, ellipsify="false",
                      raiseLayoutExceptions=False ):
    """
    Lays out the xmlMarkup in a block that is width wide.

    if raiseLayoutExceptions is False, then this function will
    suppress any exceptions raised when parsing xmlMarkup and replace
    it with a message that tells the end-user that the message was
    broken, providing the end-user with as much of the original
    message as possible.  If raiseLayoutExceptions is True, however,
Beispiel #2
0
        "help",
        font_style = "italic",
        color = "#999999",
        )
    styles.add( "ins" )
    styles.add( "alt" )
    return styles

    
_AUTOCOMPLETE_STYLES = _newLineStyleRegistry()
_SUGGESTION_STYLES   = _newLineStyleRegistry()
_DESCRIPTION_STYLES  = _newLineStyleRegistry()
_DESCRIPTION_STYLES.update( "ins", color = DESIGNER_GREEN )
_DESCRIPTION_STYLES.update( "alt", color = BLACK )

XML_ALIASES = xmltextlayout.XmlMarkupTagAliases()
XML_ALIASES.add( "line", baseElement = "block" )
XML_ALIASES.add( "ins", baseElement = "inline" )
XML_ALIASES.add( "alt", baseElement = "inline" )
XML_ALIASES.add( "help", baseElement = "inline" )

def _updateStyleSizes( styles, size ):
    """
    Updates all size-related style elements to those suggested
    when the font is of 'size' points.

    styles should be a style registry.
    """

    width = graphics.getDesktopSize()[0]
    styles.update(