4.52. umbra.ui.widgets.basic_QPlainTextEdit — Umbra 1.0.9 documentation

# 4.52. umbra.ui.widgets.basic_QPlainTextEdit

basic_QPlainTextEdit.py

Platform:
  Windows, Linux, Mac Os X.
Description:
  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.52.1. Module Attributes

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

## 4.52.2. Functions

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

  Handles edit blocks undo states.

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

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

  Anchors the text cursor position.

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

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

  Centers the text cursor position.

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

## 4.52.3. Classes

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

  Bases: `PyQt4.QtGui.QPlainTextEdit`

  Defines a QPlainTextEdit subclass providing a basic editor base class.

  Initializes the class.

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

  `patternsReplaced`

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

    Returns: | Replaced patterns.
    Return type: | list

  `searchPattern`

    Property for self.__searchPattern attribute.

    Returns: | self.__searchPattern.
    Return type: | unicode

  `minimumFontPointSize`

    Property for self.__minimumFontPointSize attribute.

    Returns: | self.__minimumFontPointSize.
    Return type: | int

  `maximumFontPointSize`

    Property for self.__maximumFontPointSize attribute.

    Returns: | self.__maximumFontPointSize.
    Return type: | int

  `wheelEvent`(event)

    Reimplements the `QPlainTextEdit.wheelEvent()` method.

    Parameters: | event (QEvent) – Event.

  `getSelectedTextMetrics`()

    Returns current document selected text metrics.

    Returns: | Selected text metrics.
    Return type: | tuple

  `getDefaultTextOption`()

    Returns default text option.

    Returns: | Default text options.
    Return type: | QTextOption

  `setDefaultTextOption`(textOption)

    Sets default text option using given flag.

    Parameters: | textOption (QTextOption) – Text option.
    Returns: | Method success.
    Return type: | bool

  `storeTextCursorAnchor`()

    Stores the document cursor anchor.

    Returns: | Method success.
    Return type: | bool

  `restoreTextCursorAnchor`()

    Restores the document cursor anchor.

    Returns: | Method success.
    Return type: | bool

  `getCursorLine`()

    Returns the document cursor line.

    Returns: | Cursor line.
    Return type: | int

  `getCursorColumn`()

    Returns the document cursor column.

    Returns: | Cursor column.
    Return type: | int

  `getPreviousCharacter`()

    Returns the character before the cursor.

    Returns: | Previous cursor character.
    Return type: | QString

  `getNextCharacter`()

    Returns the character after the cursor.

    Returns: | Next cursor character.
    Return type: | QString

  `getWords`()

    Returns the document words.

    Returns: | Document words.
    Return type: | list

  `getSelectedText`()

    Returns the document text under cursor.

    Returns: | Text under cursor.
    Return type: | QString

  `getWordUnderCursorLegacy`()

    Returns the document word under cursor ( Using Qt legacy “QTextCursor.WordUnderCursor” ).

    Returns: | Word under cursor.
    Return type: | QString

  `getWordUnderCursor`()

    Returns the document word under cursor.

    Returns: | Word under cursor.
    Return type: | QString

  `getPartialWordUnderCursor`()

    Returns the document partial word under cursor ( From word start to cursor position ).

    Returns: | Partial word under cursor.
    Return type: | QString

  `isModified`()

    Returns if the document is modified.

    Returns: | Document modified state.
    Return type: | bool

  `setModified`(state)

    Sets the document modified state.

    Parameters: | state (bool) – Modified state.
    Returns: | Method success.
    Return type: | bool

  `isEmpty`()

    Returns if the document is empty.

    Returns: | Document empty state.
    Return type: | bool

  `setContent`(content)

    Sets document with given content while providing undo capability.

    Parameters: | content (list) – Content to set.
    Returns: | Method success.
    Return type: | bool

  `delete`()

    Deletes the document text under cursor.

    Returns: | Method success.
    Return type: | bool

  `deleteLines`()

    Deletes the document lines under cursor.

    Returns: | Method success.
    Return type: | bool

  `duplicateLines`()

    Duplicates the document lines under cursor.

    Returns: | Method success.
    Return type: | bool

  `moveLines`(direction=2)

    Moves the document lines under cursor.

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

  `moveLinesUp`()

    Moves up the document lines under cursor.

    Returns: | Method success.
    Return type: | bool

  `moveLinesDown`()

    Moves down the document lines under cursor.

    Returns: | Method success.
    Return type: | bool

  `search`(pattern, **kwargs)

    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 (unicode) – Pattern to search for. **kwargs (dict) – Search settings.
    Returns: | Method success.
    Return type: | bool

  `searchNext`()

    Searchs the next search pattern in the document.

    Returns: | Method success.
    Return type: | bool

  `searchPrevious`()

    Searchs the previous search pattern in the document.

    Returns: | Method success.
    Return type: | bool

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

    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 (unicode) – Pattern to replace. replacementPattern (unicode) – Replacement pattern. **kwargs (dict) – Format settings.
    Returns: | Method success.
    Return type: | bool

  `replaceAll`(pattern, replacementPattern, **kwargs)
    Replaces every given pattern occurrences 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 (unicode) – Pattern to replace. replacementPattern (unicode) – Replacement pattern. **kwargs (dict) – Format settings.
    Returns: | Method success.
    Return type: | bool

  `gotoLine`(line)

    Moves the text cursor to given line.

    Parameters: | line (int) – Line to go to.
    Returns: | Method success.
    Return type: | bool

  `gotoColumn`(column)

    Moves the text cursor to given column.

    Parameters: | column (int) – Column to go to.
    Returns: | Method success.
    Return type: | bool

  `gotoPosition`(position)

    Moves the text cursor to given position.

    Parameters: | position (int) – Position to go to.
    Returns: | Method success.
    Return type: | bool

  `toggleWordWrap`()

    Toggles document word wrap.

    Returns: | Method success.
    Return type: | bool

  `toggleWhiteSpaces`()

    Toggles document white spaces display.

    Returns: | Method success.
    Return type: | bool

  `setFontIncrement`(value)

    Increments the document font size.

    Parameters: | value (int) – Font size increment.
    Returns: | Method success.
    Return type: | bool

  `zoomIn`()

    Increases the document font size.

    Returns: | Method success.
    Return type: | bool

  `zoomOut`()

    Increases the document font size.

    Returns: | Method success.
    Return type: | bool