4.11. 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:

4.11.1. Module Attributes

umbra.components.factory.scriptEditor.editor.LOGGER
umbra.components.factory.scriptEditor.editor.PYTHON_GRAMMAR_FILE
umbra.components.factory.scriptEditor.editor.LOGGING_GRAMMAR_FILE
umbra.components.factory.scriptEditor.editor.TEXT_GRAMMAR_FILE
umbra.components.factory.scriptEditor.editor.LANGUAGES_ACCELERATORS
umbra.components.factory.scriptEditor.editor.DEFAULT_INDENT_MARKER
umbra.components.factory.scriptEditor.editor.PYTHON_LANGUAGE
umbra.components.factory.scriptEditor.editor.LOGGING_LANGUAGE
umbra.components.factory.scriptEditor.editor.TEXT_LANGUAGE

4.11.2. Functions

umbra.components.factory.scriptEditor.editor.getObjectFromLanguageAccelerators(accelerator)[source]

This definition returns the object associated to given accelerator.

Parameters:accelerator – Accelerator. ( String )
Returns:Object. ( Object )
umbra.components.factory.scriptEditor.editor.getLanguageDescription(grammarfile)[source]

This definition gets the language description from given language grammar file.

Parameters:grammarfile – Language grammar. ( String )
Returns:Language description. ( Language )
umbra.components.factory.scriptEditor.editor.getPythonLanguage()[source]

This definition returns the Python language description.

Returns:Python language description. ( Language )
umbra.components.factory.scriptEditor.editor.getLoggingLanguage()[source]

This definition returns the Logging language description.

Returns:Logging language description. ( Language )
umbra.components.factory.scriptEditor.editor.getTextLanguage()[source]

This definition returns the Text language description.

Returns:Text language description. ( Language )

4.11.3. Classes

class umbra.components.factory.scriptEditor.editor.Language(**kwargs)[source]

Bases: foundations.dataStructures.Structure

This class represents a storage object for the Editor class language description.

Parameters:**kwargs – name, file, parser, extensions, highlighter, completer, preInputAccelerators, postInputAccelerators, visualAccelerators, indentMarker, commentMarker, commentBlockMarkerStart, commentBlockMarkerEnd, symbolsPairs, indentationSymbols, rules, tokens, theme. ( Key / Value pairs )
class umbra.components.factory.scriptEditor.editor.Editor(*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. ( ** )
languageChanged

This signal is emited by the Editor class when ComponentsManagerUi.language class property language is changed. ( pyqtSignal )

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 doucment content has been modified. ( pyqtSignal )

file[source]

This method is the property for self.__file attribute.

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

This method is the property for self.__language attribute.

Returns:self.__language. ( Language )
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(*args, **kwargs)[source]

This method sets the editor title.

Parameters:title – Editor title. ( String )
Returns:Method success. ( Boolean )
setFile(*args, **kwargs)[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 )

setLanguage(*args, **kwargs)[source]

This method sets the editor language.

Parameters:language – Language to set. ( Language )
Returns:Method success. ( Boolean )
getFileShortName(*args, **kwargs)[source]

This method returns the current editor file short name.

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

This method returns an untitled editor file name.

Returns:Untitled file name. ( String )
loadDocument(*args, **kwargs)[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(*args, **kwargs)[source]

This method creates a new editor file.

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

This method reads and loads given file into the editor.

Parameters:File – File to load. ( String )
Returns:Method success. ( Boolean )
reloadFile(*args, **kwargs)[source]

This method reloads the current editor file.

Parameters:isModified – File modified state. ( Boolean )
Returns:Method success. ( Boolean )
saveFile(*args, **kwargs)[source]

This method saves the editor file content.

Returns:Method success. ( Boolean )
saveFileAs(*args, **kwargs)[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(*args, **kwargs)[source]

This method writes the editor file content into given file.

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

This method closes the editor file.

Returns:Method success. ( Boolean )