4.54. umbra.ui.widgets.codeEditor_QPlainTextEdit — Umbra 1.0.8 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Umbra 1.0.8 documentation »
- 4. Api »

# 4.54. umbra.ui.widgets.codeEditor_QPlainTextEdit

codeEditor_QPlainTextEdit.py

Platform:
  Windows, Linux, Mac Os X.
Description:
  This module defines the `LinesNumbers_QWidget` and `CodeEditor_QPlainTextEdit` classes.
  Those objects provides the basics building blocks of a code editor widget.
Others:
  Portions of the code from codeeditor.py by Roberto Alsina: http://lateral.netmanagers.com.ar/weblog/posts/BB832.html, KhtEditor.py by Benoit Hervier: http://khertan.net/khteditor, Ninja IDE: http://ninja-ide.org/ and Prymatex: https://github.com/D3f0/prymatex/

## 4.54.1. Module Attributes

`umbra.ui.widgets.codeEditor_QPlainTextEdit.` `LOGGER`

## 4.54.2. Classes

class `umbra.ui.widgets.codeEditor_QPlainTextEdit.` `LinesNumbers_QWidget`(parent, *args, **kwargs)

  Bases: `PyQt4.QtGui.QWidget`

  This class is a QWidget subclass providing a lines numbers widget.

  Parameters: | parent – Object parent. ( QObject ) *args – Arguments. ( * ) **kwargs – Keywords arguments. ( ** )

  `editor`

    This method is the property for self.__editor attribute.

    Returns: | self.__editor. ( QWidget )

  `margin`

    This method is the property for self.__margin attribute.

    Returns: | self.__margin. ( Integer )

  `separatorWidth`

    This method is the property for self.__separatorWidth attribute.

    Returns: | self.__separatorWidth. ( Integer )

  `backgroundColor`

    This method is the property for self.__backgroundColor attribute.

    Returns: | self.__backgroundColor. ( QColor )

  `color`

    This method is the property for self.__color attribute.

    Returns: | self.__color. ( QColor )

  `separatorColor`

    This method is the property for self.__separatorColor attribute.

    Returns: | self.__separatorColor. ( QColor )

  `sizeHint`()

    This method reimplements the `QWidget.sizeHint()` method.

    Returns: | Size hint. ( QSize )

  `paintEvent`(event)

    This method reimplements the `QWidget.paintEvent()` method.

    Parameters: | event – Event. ( QEvent )

  `getWidth`()

    This method returns the Widget target width.

    Returns: | Widget target width. ( Integer )

  `setEditorViewportMargins`(newBlocksCount)

    This method sets the editor viewport margins.

    Parameters: | newBlocksCount – Updated editor blocks count. ( Integer )
    Returns: | Method success. ( Boolean )

  `updateRectangle`(rectangle, scrollY)

    This method updates the given widget rectangle.

    Parameters: | rectangle – Rectangle to update. ( QRect ) scrollY – Amount of pixels the viewport was scrolled. ( Integer )
    Returns: | Method success. ( Boolean )

  `updateGeometry`()

    This method updates the widget geometry.

    Returns: | Method success. ( Boolean )

class `umbra.ui.widgets.codeEditor_QPlainTextEdit.` `CodeEditor_QPlainTextEdit`(parent=None, language=None, indentMarker=u't', indentWidth=4, commentMarker=u'#', *args, **kwargs)

  Bases: `umbra.ui.widgets.basic_QPlainTextEdit.Basic_QPlainTextEdit`

  This class provides a code editor base class.

  Parameters: | parent – Widget parent. ( QObject ) language – Editor language. ( Language ) indentMarker – Indentation marker. ( String ) indentWidth – Indentation spaces count. ( Integer ) commentMarker – Comment marker. ( String ) *args – Arguments. ( * ) **kwargs – Keywords arguments. ( ** )

  `languageChanged`

    This signal is emited by the `Editor` class when `ComponentsManagerUi.language` class property language is changed. ( pyqtSignal )

  `language`

    This method is the property for self.__language attribute.

    Returns: | self.__language. ( Language )

  `indentMarker`

    This method is the property for self.__indentMarker attribute.

    Returns: | self.__indentMarker. ( String )

  `indentWidth`

    This method is the property for self.__indentWidth attribute.

    Returns: | self.__indentWidth. ( Integer )

  `commentMarker`

    This method is the property for self.__commentMarker attribute.

    Returns: | self.__commentMarker. ( String )

  `marginArea_LinesNumbers_widget`

    This method is the property for self.__marginArea_LinesNumbers_widget attribute.

    Returns: | self.__marginArea_LinesNumbers_widget. ( LinesNumbers_QWidget )

  `highlighter`

    This method is the property for self.__highlighter attribute.

    Returns: | self.__highlighter. ( QSyntaxHighlighter )

  `completer`

    This method is the property for self.__completer attribute.

    Returns: | self.__completer. ( QCompleter )

  `preInputAccelerators`

    This method is the property for self.__preInputAccelerators attribute.

    Returns: | self.__preInputAccelerators. ( Tuple / List )

  `postInputAccelerators`

    This method is the property for self.__postInputAccelerators attribute.

    Returns: | self.__postInputAccelerators. ( Tuple / List )

  `visualAccelerators`

    This method is the property for self.__visualAccelerators attribute.

    Returns: | self.__visualAccelerators. ( Tuple / List )

  `resizeEvent`(event)

    This method reimplements the `Basic_QPlainTextEdit.resizeEvent()` method.

    Parameters: | event – Event. ( QEvent )

  `keyPressEvent`(event)

    This method reimplements the `Basic_QPlainTextEdit.keyPressEvent()` method.

    Parameters: | event – Event. ( QEvent )

  `setLanguage`(language)

    This method sets the language.

    Parameters: | language – Language to set. ( Language )
    Returns: | Method success. ( Boolean )

  `setHighlighter`(highlighter)

    This method sets given highlighter as the current document highlighter.

    Parameters: | highlighter – Highlighter. ( QSyntaxHighlighter )
    Returns: | Method success. ( Boolean )

  `removeHighlighter`()

    This method removes current highlighter.

    Returns: | Method success. ( Boolean )

  `setCompleter`(completer)

    This method sets given completer as the current completer.

    Parameters: | completer – Completer. ( QCompleter )
    Returns: | Method success. ( Boolean )

  `removeCompleter`()

    This method removes current completer.

    Returns: | Method success. ( Boolean )

  `getMatchingSymbolsPairs`(cursor, openingSymbol, closingSymbol, backward=False)

    This method returns the cursor for matching given symbols pairs.

    Parameters: | cursor – Cursor to match from. ( QTextCursor ) openingSymbol – Opening symbol. ( String ) closingSymbol – Closing symbol to match. ( String )
    Returns: | Matching cursor. ( QTextCursor )

  `indent`()

    This method indents the document text under cursor.

    Returns: | Method success. ( Boolean )

  `unindent`()

    This method unindents the document text under cursor.

    Returns: | Method success. ( Boolean )

  `toggleComments`()

    This method toggles comments on the document selected lines.

    Returns: | Method success. ( Boolean )

  `removeTrailingWhiteSpaces`()

    This method removes document trailing white spaces.

    Returns: | Method success. ( Boolean )

  `convertIndentationToTabs`()

    This method converts document indentation to tabs.

    Returns: | Method success. ( Boolean )

  `convertIndentationToSpaces`()

    This method converts document indentation to spaces.

    Returns: | Method success. ( Boolean )

### Navigation

- index
- modules |
- next |
- previous |
- Umbra 1.0.8 documentation »
- 4. Api »