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)[source]

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[source]

Property for self.__file attribute.

Returns:self.__file.
Return type:unicode
defaultFontsSettings[source]

Property for self.__defaultFontsSettings attribute.

Returns:self.__defaultFontsSettings.
Return type:dict
tabWidth[source]

Property for self.__tabWidth attribute.

Returns:self.__tabWidth.
Return type:int
title[source]

Property for self.__title attribute.

Returns:self.__title.
Return type:unicode
isUntitled[source]

Property for self.__isUntitled attribute.

Returns:self.__isUntitled.
Return type:bool
defaultFileName[source]

Property for self.__defaultFileName attribute.

Returns:self.__defaultFileName.
Return type:unicode
defaultFileExtension[source]

Property for self.__defaultFileExtension attribute.

Returns:self.__defaultFileExtension.
Return type:unicode
setTitle(title=None)[source]

Sets the editor title.

Parameters:title (unicode) – Editor title.
Returns:Method success.
Return type:bool
setFile(file=None, isModified=False, isUntitled=False)[source]

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()[source]

Returns the current editor file short name.

Returns:File short name.
Return type:unicode
getUntitledFileName()[source]

Returns an untitled editor file name.

Returns:Untitled file name.
Return type:unicode
loadDocument(document, file=None, language=None)[source]

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()[source]

Creates a new editor file.

Returns:File name.
Return type:unicode
loadFile(file)[source]

Reads and loads given file into the editor.

Parameters:File (unicode) – File to load.
Returns:Method success.
Return type:bool
reloadFile(isModified=True)[source]

Reloads the current editor file.

Parameters:isModified (bool) – File modified state.
Returns:Method success.
Return type:bool
saveFile()[source]

Saves the editor file content.

Returns:Method success.
Return type:bool
saveFileAs(file=None)[source]

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)[source]

Writes the editor file content into given file.

Parameters:file (unicode) – File to write.
Returns:Method success.
Return type:bool
closeFile()[source]

Closes the editor file.

Returns:Method success.
Return type:bool