The gadgets package#

Various Qt-related helper classes and objects.

The gadgets.extraselectionmanager module#

ExtraSelectionManager managages highlighting of arbitrary sections in a Q(Plain)TextEdit.

class ExtraSelectionManager(textedit)[source]#

Bases: SingleInstance

Manages highlighting of arbitrary sections in a Q(Plain)TextEdit.

Stores and highlights lists of QTextCursors on a per-format basis.

Instantiate with:

ExtraSelectionManager.instance(textedit)

This ensures you get the same instance each time, and only one instance is created.

highlight(text_format, cursors, priority=0, msec=0)[source]#

Highlight the selection of an arbitrary list of QTextCursors.

text_format is a QTextCharFormat; priority determines the order of drawing, highlighting with higher priority is drawn over highlighting with lower priority. msec, if > 0, removes the highlighting after that many milliseconds.

clear(text_format=None)[source]#

Remove the highlighting for the given QTextCharFormat.

If text_format is None, removes all highlighting.

delete()[source]#

Reimplemented to remove all highlighting before delete.

The gadgets.languagemenuaction module#

LanguageMenuAction is a QAction that shows a section-based submenu for all languages in the/a parce Registry.

class LanguageMenuAction(parent=None, registry=None)[source]#

Bases: QAction

A QAction that shows a section-based submenu for all languages in the/a parce Registry.

lexicon_changed#

This signal is emitted when a language is selected by the user.

The single argument is a Lexicon or None.

set_registry(registry)[source]#

Set the Registry and populate ourselves with the lexicons from the registry.

registry()[source]#

Return the currently set Registry.

display_name(qualname)[source]#

Return the text to display for the qualname.

By default the desc and the name between parentheses from the registry’s entry is returned. If the qualname is None or the empty string, returns "None".

set_lexicon(lexicon)[source]#

Set the current lexicon, or None.

lexicon()[source]#

Return the current lexicon.