usdmanager.highlighter module

Custom syntax highlighters.

class usdmanager.highlighter.Highlighter(parent=None, master=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

highlightBlock(text)[source]

Override this method only if needed for a specific language.

isDirty()[source]
masterClass

alias of MasterHighlighter

setDirty()[source]
class usdmanager.highlighter.MasterHighlighter(parent, enableSyntaxHighlighting=False, programs=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Master object containing shared highlighting rules.

comment = '#'
createRules()[source]
dirtied

Used by autodoc_mock_imports.

dirty()[source]

Let highlighters that subscribe to this know a rule has changed.

extensions = [None]
getRules()[source]

Syntax rules specific to this highlighter class.

multilineComment = None
setFindCase(case)[source]

Set the case sensitivity when searching for text.

Parameters:
case : bool

Find is case-sensitive if True.

setFindPhrase(phrase)[source]

Set the “find” phrase when searching for text.

Parameters:
phrase : str

Text in find bar to search for.

setLinkPattern(programs)[source]

Set the rules to search for files based on file extensions, quotes, etc.

Parameters:
programs : dict

extension: program pairs of strings.

setSyntaxHighlighting(enable, force=True)[source]

Enable/Disable syntax highlighting. If enabling, dirties the state of this highlighter so highlighting runs again.

Parameters:
enable : bool

Whether or not to enable syntax highlighting.

force : bool

Force re-enabling syntax highlighting even if it was already enabled. Allows force rehighlighting even if nothing has really changed.

usdmanager.highlighter.createMultilineRule(startPattern, endPattern, color=None, darkColor=None, weight=None, italic=False, cs=<sphinx.ext.autodoc.importer._MockObject object>)[source]

Create a multiline syntax highlighting rule.

Parameters:
startPattern : str

RegEx to match for the start of the block of lines.

endPattern : str

RegEx to match for the end of the block of lines.

color : QtGui.QColor

Color to highlight matches

darkColor : QtGui.QColor

Color to highlight matches when in a dark background theme.

weight : int | None

Optional font weight for matches

italic : bool

Set the font to italic

cs : int

Case sensitivity for RegEx matching

Returns:

Tuple of QtCore.QRegExp and QtGui.QTextCharFormat objects.

Rtype:

tuple

usdmanager.highlighter.createRule(pattern, color=None, darkColor=None, weight=None, italic=False, cs=<sphinx.ext.autodoc.importer._MockObject object>)[source]

Create a single-line syntax highlighting rule.

Parameters:
pattern : str

RegEx to match

color : QtGui.QColor

Color to highlight matches when in a light background theme

darkColor : QtGui.QColor

Color to highlight matches when in a dark background theme. Defaults to color if not given.

weight : int | None

Optional font weight for matches

italic : bool

Set the font to italic

cs : int

Case sensitivity for RegEx matching

Returns:

Tuple of QtCore.QRegExp and QtGui.QTextCharFormat objects.

Rtype:

tuple

usdmanager.highlighter.findHighlighters()[source]

Get the installed highlighter classes.

Returns:List of MasterHighlighter objects
Rtype:list