4.15. umbra.components.factory.scriptEditor.editor — Umbra 1.0.9 documentation

# 4.15. umbra.components.factory.scriptEditor.editor

editor.py

Platform:
  Windows, Linux, Mac Os X.
Description:
  Defines the `Editor` class and others editing helper objects.

Others:

## 4.15.1. Module Attributes

`umbra.components.factory.scriptEditor.editor.` `LOGGER`

## 4.15.2. Classes

class `umbra.components.factory.scriptEditor.editor.` `Editor`(parent=None, file=None, language=None, *args, **kwargs)

  Bases: `umbra.ui.widgets.codeEditor_QPlainTextEdit.CodeEditor_QPlainTextEdit`

  Defines the default editor used by the `umbra.components.factory.scriptEditor.scriptEditor.ScriptEditor` Component Interface class.

  Initializes the class.

  Parameters: | parent (QObject) – Object parent. file (unicode) – File path. language (Language) – Editor language. *args (*) – Arguments. **kwargs (**) – Keywords arguments.

  `titleChanged`

    This signal is emited by the `Editor` class when the current title is changed. ( pyqtSignal )

  `fileLoaded`

    This signal is emited by the `Editor` class when the current file is loaded. ( pyqtSignal )

  `fileSaved`

    This signal is emited by the `Editor` class when the current file is saved. ( pyqtSignal )

  `fileReloaded`

    This signal is emited by the `Editor` class when the current file is reloaded. ( pyqtSignal )

  `fileClosed`

    This signal is emited by the `Editor` class when the current file is closed. ( pyqtSignal )

  `contentsChanged`

    This signal is emited by the `Editor` class when the current editor document content has changed. ( pyqtSignal )

  `modificationChanged`

    This signal is emited by the `Editor` class when the current editor document content has been modified. ( pyqtSignal )

  `file`

    Property for self.__file attribute.

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

  `defaultFontsSettings`

    Property for self.__defaultFontsSettings attribute.

    Returns: | self.__defaultFontsSettings.
    Return type: | dict

  `tabWidth`

    Property for self.__tabWidth attribute.

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

  `title`

    Property for self.__title attribute.

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

  `isUntitled`

    Property for self.__isUntitled attribute.

    Returns: | self.__isUntitled.
    Return type: | bool

  `defaultFileName`

    Property for self.__defaultFileName attribute.

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

  `defaultFileExtension`

    Property for self.__defaultFileExtension attribute.

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

  `setTitle`(title=None)

    Sets the editor title.

    Parameters: | title (unicode) – Editor title.
    Returns: | Method success.
    Return type: | bool

  `setFile`(file=None, isModified=False, isUntitled=False)

    Sets the editor file.

    Parameters: | File (unicode) – File to set. isModified (bool) – File modified state. isUntitled (bool) – File untitled state.
    Returns: | Method success.
    Return type: | bool

  `getFileShortName`()

    Returns the current editor file short name.

    Returns: | File short name.
    Return type: | unicode

  `getUntitledFileName`()

    Returns an untitled editor file name.

    Returns: | Untitled file name.
    Return type: | unicode

  `loadDocument`(document, file=None, language=None)

    Loads given document into the editor.

    Parameters: | document (QTextDocument) – Document to load. file (unicode) – File. language (unicode) – Editor language.
    Returns: | Method success.
    Return type: | bool

  `newFile`()

    Creates a new editor file.

    Returns: | File name.
    Return type: | unicode

  `loadFile`(file)

    Reads and loads given file into the editor.

    Parameters: | File (unicode) – File to load.
    Returns: | Method success.
    Return type: | bool

  `reloadFile`(isModified=True)

    Reloads the current editor file.

    Parameters: | isModified (bool) – File modified state.
    Returns: | Method success.
    Return type: | bool

  `saveFile`()

    Saves the editor file content.

    Returns: | Method success.
    Return type: | bool

  `saveFileAs`(file=None)

    Saves the editor file content either using given file or user chosen file.

    Returns: | Method success.
    Return type: | bool
    Note: | May require user interaction.

  `writeFile`(file)

    Writes the editor file content into given file.

    Parameters: | file (unicode) – File to write.
    Returns: | Method success.
    Return type: | bool

  `closeFile`()

    Closes the editor file.

    Returns: | Method success.
    Return type: | bool