6.42. umbra.components.factory.scriptEditor.editor

editor.py

Platform:
Windows, Linux, Mac Os X.
Description:
This module defines the Editor class and others editing helper objects.

Others:

6.42.1. Module Attributes

umbra.components.factory.scriptEditor.editor.LOGGER

6.42.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

This class defines the default editor used by the umbra.components.factory.scriptEditor.scriptEditor.ScriptEditor Component Interface class.

Parameters:
  • parent – Object parent. ( QObject )
  • file – File path. ( String )
  • language – Editor language. ( 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]

This method is the property for self.__file attribute.

Returns:self.__file. ( String )
defaultFontsSettings[source]

This method is the property for self.__defaultFontsSettings attribute.

Returns:self.__defaultFontsSettings. ( Dictionary )
tabWidth[source]

This method is the property for self.__tabWidth attribute.

Returns:self.__tabWidth. ( Integer )
title[source]

This method is the property for self.__title attribute.

Returns:self.__title. ( String )
isUntitled[source]

This method is the property for self.__isUntitled attribute.

Returns:self.__isUntitled. ( Boolean )
defaultFileName[source]

This method is the property for self.__defaultFileName attribute.

Returns:self.__defaultFileName. ( String )
defaultFileExtension[source]

This method is the property for self.__defaultFileExtension attribute.

Returns:self.__defaultFileExtension. ( String )
setTitle(title=None)[source]

This method sets the editor title.

Parameters:title – Editor title. ( String )
Returns:Method success. ( Boolean )
setFile(file=None, isModified=False, isUntitled=False)[source]

This method sets the editor file.

Parameters:
  • File – File to set. ( String )
  • isModified – File modified state. ( Boolean )
  • isUntitled – File untitled state. ( Boolean )
Returns:

Method success. ( Boolean )

getFileShortName()[source]

This method returns the current editor file short name.

Returns:File short name. ( String )
getUntitledFileName()[source]

This method returns an untitled editor file name.

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

This method loads given document into the editor.

Parameters:
  • document – Document to load. ( QTextDocument )
  • file – File. ( String )
  • language – Editor language. ( String )
Returns:

Method success. ( Boolean )

newFile()[source]

This method creates a new editor file.

Returns:File name. ( String )
loadFile(*args, **kwargs)[source]

This decorator is used for exceptions handling.

Parameters:
  • *args – Arguments. ( * )
  • **kwargs – Keywords arguments. ( ** )
reloadFile(*args, **kwargs)[source]

This decorator is used for exceptions handling.

Parameters:
  • *args – Arguments. ( * )
  • **kwargs – Keywords arguments. ( ** )
saveFile()[source]

This method saves the editor file content.

Returns:Method success. ( Boolean )
saveFileAs(file=None)[source]

This method saves the editor file content either using given file or user chosen file.

Returns:Method success. ( Boolean )
Note :This method may require user interaction.
writeFile(file)[source]

This method writes the editor file content into given file.

Parameters:file – File to write. ( String )
Returns:Method success. ( Boolean )
closeFile()[source]

This method closes the editor file.

Returns:Method success. ( Boolean )