4.38. umbra.ui.highlighters

highlighters.py

Platform:
Windows, Linux, Mac Os X.
Description:
This module defines the Application highlighters classes.
Others:
Portions of the code from PyQtWiki: http://diotavelli.net/PyQtWiki/Python%20syntax%20highlighting

4.38.1. Module Attributes

umbra.ui.highlighters.LOGGER

4.38.2. Classes

class umbra.ui.highlighters.Rule(**kwargs)[source]

Bases: foundations.dataStructures.Structure

This class represents a storage object for highlighters rule.

Parameters:**kwargs – pattern, format. ( Key / Value pairs )
class umbra.ui.highlighters.FormatsTree(theme=None)[source]

Bases: object

This class defines the formats tree object representing higlighters theme.

Parameters:theme – Theme. ( Dictionary )
rootNode[source]

This method is the property for self.__rootNode attribute.

Returns:self.__rootNode. ( AbstractCompositeNode )
listFormats(node, path=(), formats=None)[source]

This method lists the object formats in sorted order.

Parameters:
  • node – Root node to start listing the formats from. ( AbstractCompositeNode )
  • path – Walked paths. ( Tuple )
  • formats – Formats. ( List )
Returns:

Formats. ( List )

getFormat(name)[source]

This method returns the closest format or closest parent format associated to given name.

Parameters:name – Format name. ( String)
Returns:Format. ( QTextCharFormat )
class umbra.ui.highlighters.AbstractHighlighter(parent=None)[source]

Bases: PyQt4.QtGui.QSyntaxHighlighter

This class is a QSyntaxHighlighter subclass used as a base for highlighters classes.

Parameters:parent – Widget parent. ( QObject )
formats[source]

This method is the property for self.__formats attribute.

Returns:self.__formats. ( FormatsTree )
rules[source]

This method is the property for self.__rules attribute.

Returns:self.__rules. ( Tuple / List )
highlightBlock(block)[source]

This method reimplements the QSyntaxHighlighter.highlightBlock() method.

Parameters:block – Text block. ( QString )
highlightText(text, start, end)[source]

This method highlights given text.

Parameters:
  • text – Text. ( QString )
  • start – Text start index. ( Integer )
  • end – Text end index. ( Integer )
Returns:

Method success. ( Boolean )

class umbra.ui.highlighters.DefaultHighlighter(parent=None, rules=None, theme=None)[source]

Bases: umbra.ui.highlighters.AbstractHighlighter

This class is a AbstractHighlighter subclass providing syntax highlighting for documents.

Parameters:
  • parent – Widget parent. ( QObject )
  • rules – Rules. ( Tuple / List )
  • theme – Theme. ( Dictionary )
theme[source]

This method is the property for self.__theme attribute.

Returns:self.__theme. ( Dictionary )
highlightBlock(block)[source]

This method reimplements the AbstractHighlighter.highlightBlock() method.

Parameters:block – Text block. ( QString )
highlightMultilineBlock(block, startPattern, endPattern, state, format)[source]

This method highlights given multiline text block.

Parameters:
  • block – Text block. ( QString )
  • pattern – Start regex pattern. ( QRegExp )
  • pattern – End regex pattern. ( QRegExp )
  • format – Format. ( QTextCharFormat )
  • state – Block state. ( Integer )
Returns:

Current block matching state. ( Boolean )

Table Of Contents

Previous topic

4.37. umbra.ui.delegates

Next topic

4.39. umbra.ui.inputAccelerators

This Page