4.53. umbra.ui.widgets.codeEditor_QPlainTextEdit
codeEditor_QPlainTextEdit.py
- Platform:
- Windows, Linux, Mac Os X.
- Description:
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.53.1. Module Attributes
-
umbra.ui.widgets.codeEditor_QPlainTextEdit.LOGGER
4.53.2. Classes
-
class umbra.ui.widgets.codeEditor_QPlainTextEdit.LinesNumbers_QWidget(parent, *args, **kwargs)[source]
Bases: PyQt4.QtGui.QWidget
Defines a QWidget subclass providing a lines numbers widget.
Initializes the class.
| Parameters: |
- parent (QObject) – Object parent.
- *args (*) – Arguments.
- **kwargs (**) – Keywords arguments.
|
-
editor[source]
Property for self.__editor attribute.
| Returns: | self.__editor. |
| Return type: | QWidget |
-
margin[source]
Property for self.__margin attribute.
| Returns: | self.__margin. |
| Return type: | int |
-
separatorWidth[source]
Property for self.__separatorWidth attribute.
| Returns: | self.__separatorWidth. |
| Return type: | int |
-
backgroundColor[source]
Property for self.__backgroundColor attribute.
| Returns: | self.__backgroundColor. |
| Return type: | QColor |
-
color[source]
Property for self.__color attribute.
| Returns: | self.__color. |
| Return type: | QColor |
-
separatorColor[source]
Property for self.__separatorColor attribute.
| Returns: | self.__separatorColor. |
| Return type: | QColor |
-
sizeHint()[source]
Reimplements the QWidget.sizeHint() method.
| Returns: | Size hint. |
| Return type: | QSize |
-
paintEvent(event)[source]
Reimplements the QWidget.paintEvent() method.
| Parameters: | event (QEvent) – Event. |
-
getWidth()[source]
Returns the Widget target width.
| Returns: | Widget target width. |
| Return type: | int |
-
setEditorViewportMargins(newBlocksCount)[source]
Sets the editor viewport margins.
| Parameters: | newBlocksCount (int) – Updated editor blocks count. |
| Returns: | Method success. |
| Return type: | bool |
-
updateRectangle(rectangle, scrollY)[source]
Updates the given Widget rectangle.
| Parameters: |
- rectangle (QRect) – Rectangle to update.
- scrollY (int) – Amount of pixels the viewport was scrolled.
|
| Returns: | Method success.
|
| Return type: | bool
|
-
updateGeometry()[source]
Updates the Widget geometry.
| Returns: | Method success. |
| Return type: | bool |
-
class umbra.ui.widgets.codeEditor_QPlainTextEdit.CodeEditor_QPlainTextEdit(parent=None, language=None, indentMarker=u't', indentWidth=4, commentMarker=u'#', *args, **kwargs)[source]
Bases: umbra.ui.widgets.basic_QPlainTextEdit.Basic_QPlainTextEdit
Defines a code editor base class.
Initializes the class.
| Parameters: |
- parent (QObject) – Widget parent.
- language (Language) – Editor language.
- indentMarker (unicode) – Indentation marker.
- indentWidth (int) – Indentation spaces count.
- commentMarker (unicode) – Comment marker.
- *args (*) – Arguments.
- **kwargs (**) – Keywords arguments.
|
-
languageChanged
This signal is emited by the Editor class when ComponentsManagerUi.language class property language
is changed. ( pyqtSignal )
-
language[source]
Property for self.__language attribute.
| Returns: | self.__language. |
| Return type: | Language |
-
indentMarker[source]
Property for self.__indentMarker attribute.
| Returns: | self.__indentMarker. |
| Return type: | unicode |
-
indentWidth[source]
Property for self.__indentWidth attribute.
| Returns: | self.__indentWidth. |
| Return type: | int |
Property for self.__commentMarker attribute.
| Returns: | self.__commentMarker. |
| Return type: | unicode |
-
marginArea_LinesNumbers_widget[source]
Property for self.__marginArea_LinesNumbers_widget attribute.
| Returns: | self.__marginArea_LinesNumbers_widget. |
| Return type: | LinesNumbers_QWidget |
-
highlighter[source]
Property for self.__highlighter attribute.
| Returns: | self.__highlighter. |
| Return type: | QSyntaxHighlighter |
-
completer[source]
Property for self.__completer attribute.
| Returns: | self.__completer. |
| Return type: | QCompleter |
-
preInputAccelerators[source]
Property for self.__preInputAccelerators attribute.
| Returns: | self.__preInputAccelerators. |
| Return type: | tuple or list |
-
postInputAccelerators[source]
Property for self.__postInputAccelerators attribute.
| Returns: | self.__postInputAccelerators. |
| Return type: | tuple or list |
-
visualAccelerators[source]
Property for self.__visualAccelerators attribute.
| Returns: | self.__visualAccelerators. |
| Return type: | tuple or list |
-
resizeEvent(event)[source]
Reimplements the Basic_QPlainTextEdit.resizeEvent() method.
| Parameters: | event (QEvent) – Event. |
-
keyPressEvent(event)[source]
Reimplements the Basic_QPlainTextEdit.keyPressEvent() method.
| Parameters: | event (QEvent) – Event. |
-
setLanguage(language)[source]
Sets the language.
| Parameters: | language (Language) – Language to set. |
| Returns: | Method success. |
| Return type: | bool |
-
setHighlighter(highlighter)[source]
Sets given highlighter as the current document highlighter.
| Parameters: | highlighter (QSyntaxHighlighter) – Highlighter. |
| Returns: | Method success. |
| Return type: | bool |
-
removeHighlighter()[source]
Removes current highlighter.
| Returns: | Method success. |
| Return type: | bool |
-
setCompleter(completer)[source]
Sets given completer as the current completer.
| Parameters: | completer (QCompleter) – Completer. |
| Returns: | Method success. |
| Return type: | bool |
-
removeCompleter()[source]
Removes current completer.
| Returns: | Method success. |
| Return type: | bool |
-
getMatchingSymbolsPairs(cursor, openingSymbol, closingSymbol, backward=False)[source]
Returns the cursor for matching given symbols pairs.
| Parameters: |
- cursor (QTextCursor) – Cursor to match from.
- openingSymbol (unicode) – Opening symbol.
- closingSymbol (unicode) – Closing symbol to match.
|
| Returns: | Matching cursor.
|
| Return type: | QTextCursor
|
-
indent()[source]
Indents the document text under cursor.
| Returns: | Method success. |
| Return type: | bool |
-
unindent()[source]
Unindents the document text under cursor.
| Returns: | Method success. |
| Return type: | bool |
Toggles comments on the document selected lines.
| Returns: | Method success. |
| Return type: | bool |
-
removeTrailingWhiteSpaces()[source]
Removes document trailing white spaces.
| Returns: | Method success. |
| Return type: | bool |
-
convertIndentationToTabs()[source]
Converts document indentation to tabs.
| Returns: | Method success. |
| Return type: | bool |
-
convertIndentationToSpaces()[source]
Converts document indentation to spaces.
| Returns: | Method success. |
| Return type: | bool |