4.53. umbra.ui.widgets.basic_QPlainTextEdit — Umbra 1.0.8 documentation

### Navigation

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

# 4.53. umbra.ui.widgets.basic_QPlainTextEdit

basic_QPlainTextEdit.py

Platform:
  Windows, Linux, Mac Os X.
Description:
  This module defines the `Basic_QPlainTextEdit` class.
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.53.1. Module Attributes

`umbra.ui.widgets.basic_QPlainTextEdit.` `LOGGER`

## 4.53.2. Functions

`umbra.ui.widgets.basic_QPlainTextEdit.` `editBlock`(object)

  This decorator is used to handle edit blocks undo states.

  Parameters: | object – Object to decorate. ( Object )
  Returns: | Object. ( Object )

`umbra.ui.widgets.basic_QPlainTextEdit.` `anchorTextCursor`(object)

  This decorator is used to anchor the text cursor position.

  Parameters: | object – Object to decorate. ( Object )
  Returns: | Object. ( Object )

`umbra.ui.widgets.basic_QPlainTextEdit.` `centerTextCursor`(object)

  This decorator is used to center the text cursor position.

  Parameters: | object – Object to decorate. ( Object )
  Returns: | Object. ( Object )

## 4.53.3. Classes

class `umbra.ui.widgets.basic_QPlainTextEdit.` `Basic_QPlainTextEdit`(parent=None, *args, **kwargs)

  Bases: `PyQt4.QtGui.QPlainTextEdit`

  This class is a QPlainTextEdit subclass providing a basic editor base class.

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

  `patternsReplaced`

    This signal is emited by the `Basic_QPlainTextEdit` class when patterns have been replaced. ( pyqtSignal )

    Returns: | Replaced patterns. ( List )

  `searchPattern`

    This method is the property for self.__searchPattern attribute.

    Returns: | self.__searchPattern. ( String )

  `minimumFontPointSize`

    This method is the property for self.__minimumFontPointSize attribute.

    Returns: | self.__minimumFontPointSize. ( Integer )

  `maximumFontPointSize`

    This method is the property for self.__maximumFontPointSize attribute.

    Returns: | self.__maximumFontPointSize. ( Integer )

  `wheelEvent`(event)

    This method reimplements the `QPlainTextEdit.wheelEvent()` method.

    Parameters: | event – Event. ( QEvent )

  `getSelectedTextMetrics`()

    This method returns current document selected text metrics.

    Returns: | Selected text metrics. ( Tuple )

  `getDefaultTextOption`()

    This method returns default text option.

    Returns: | Default text options. ( QTextOption )

  `setDefaultTextOption`(textOption)

    This method sets default text option using given flag.

    Parameters: | textOption – Text option. ( QTextOption )
    Returns: | Method success. ( Boolean )

  `storeTextCursorAnchor`()

    This method stores the document cursor anchor.

    Returns: | Method success. ( Boolean )

  `restoreTextCursorAnchor`()

    This method restores the document cursor anchor.

    Returns: | Method success. ( Boolean )

  `getCursorLine`()

    This method returns the document cursor line.

    Returns: | Cursor line. ( Integer )

  `getCursorColumn`()

    This method returns the document cursor column.

    Returns: | Cursor column. ( Integer )

  `getPreviousCharacter`()

    This method returns the character before the cursor.

    Returns: | Previous cursor character. ( QString )

  `getNextCharacter`()

    This method returns the character after the cursor.

    Returns: | Next cursor character. ( QString )

  `getWords`()

    This method returns the document words.

    Returns: | Document words. ( List )

  `getSelectedText`()

    This method returns the document text under cursor.

    Returns: | Text under cursor. ( QString )

  `getWordUnderCursorLegacy`()

    This method returns the document word under cursor ( Using Qt legacy “QTextCursor.WordUnderCursor” ).

    Returns: | Word under cursor. ( QString )

  `getWordUnderCursor`()

    This method returns the document word under cursor.

    Returns: | Word under cursor. ( QString )

  `getPartialWordUnderCursor`()

    This method returns the document partial word under cursor ( From word start to cursor position ).

    Returns: | Partial word under cursor. ( QString )

  `isModified`()

    This method returns if the document is modified.

    Returns: | Document modified state. ( Boolean )

  `setModified`(state)

    This method sets the document modified state.

    Parameters: | state – Modified state. ( Boolean )
    Returns: | Method success. ( Boolean )

  `isEmpty`()

    This method returns if the document is empty.

    Returns: | Document empty state. ( Boolean )

  `setContent`(content)

    This method sets document with given content while providing undo capability.

    Parameters: | content – Content to set. ( List )
    Returns: | Method success. ( Boolean )

  `delete`()

    This method deletes the document text under cursor.

    Returns: | Method success. ( Boolean )

  `deleteLines`()

    This method deletes the document lines under cursor.

    Returns: | Method success. ( Boolean )

  `duplicateLines`()

    This method duplicates the document lines under cursor.

    Returns: | Method success. ( Boolean )

  `moveLines`(direction=2)

    This method moves the document lines under cursor.

    Parameters: | direction – Move direction ( QTextCursor.Down / QTextCursor.Up ). ( QTextCursor.MoveOperation )
    Returns: | Method success. ( Boolean )

  `moveLinesUp`()

    This method moves up the document lines under cursor.

    Returns: | Method success. ( Boolean )

  `moveLinesDown`()

    This method moves down the document lines under cursor.

    Returns: | Method success. ( Boolean )

  `search`(pattern, **kwargs)

    This method searchs given pattern text in the document.

    Usage:

        >>> scriptEditor = Umbra.componentsManager.getInterface("factory.scriptEditor")
        True
        >>> codeEditor = scriptEditor.getCurrentEditor()
        True
        >>> codeEditor.search(searchPattern, caseSensitive=True, wholeWord=True, regularExpressions=True, backwardSearch=True, wrapAround=True)
        True

    Parameters: | pattern – Pattern to search for. ( String ) **kwargs – Search settings. ( Key / Value pairs )
    Returns: | Method success. ( Boolean )

  `searchNext`()

    This method searchs the next search pattern in the document.

    Returns: | Method success. ( Boolean )

  `searchPrevious`()

    This method searchs the previous search pattern in the document.

    Returns: | Method success. ( Boolean )

  `replace`(pattern, replacementPattern, **kwargs)

    This method replaces current given pattern occurence in the document with the replacement pattern.

    Usage:

        >>> scriptEditor = Umbra.componentsManager.getInterface("factory.scriptEditor")
        True
        >>> codeEditor = scriptEditor.getCurrentEditor()
        True
        >>> codeEditor.replace(searchPattern, replacementPattern, caseSensitive=True, wholeWord=True, regularExpressions=True, backwardSearch=True, wrapAround=True)
        True

    Parameters: | pattern – Pattern to replace. ( String ) replacementPattern – Replacement pattern. ( String ) **kwargs – Format settings. ( Key / Value pairs )
    Returns: | Method success. ( Boolean )

  `replaceAll`(pattern, replacementPattern, **kwargs)
    This method replaces every given pattern occurences in the document with the replacement pattern.

    Warning

    Initializing wrapAround keyword to True leads to infinite recursion loop if the search pattern and the replacementPattern are the same.

    Parameters: | pattern – Pattern to replace. ( String ) replacementPattern – Replacement pattern. ( String ) **kwargs – Format settings. ( Key / Value pairs )
    Returns: | Method success. ( Boolean )

  `gotoLine`(line)

    This method moves the text cursor to given line.

    Parameters: | line – Line to go to. ( Integer )
    Returns: | Method success. ( Boolean )

  `gotoColumn`(column)

    This method moves the text cursor to given column.

    Parameters: | column – Column to go to. ( Integer )
    Returns: | Method success. ( Boolean )

  `gotoPosition`(position)

    This method moves the text cursor to given position.

    Parameters: | position – Position to go to. ( Integer )
    Returns: | Method success. ( Boolean )

  `toggleWordWrap`()

    This method toggles document word wrap.

    Returns: | Method success. ( Boolean )

  `toggleWhiteSpaces`()

    This method toggles document white spaces display.

    Returns: | Method success. ( Boolean )

  `setFontIncrement`(value)

    This method increments the document font size.

    Parameters: | value – Font size increment. ( Integer )
    Returns: | Method success. ( Boolean )

  `zoomIn`()

    This method increases the document font size.

    Returns: | Method success. ( Boolean )

  `zoomOut`()

    This method increases the document font size.

    Returns: | Method success. ( Boolean )

### Navigation

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