4.19. umbra.components.factory.scriptEditor.scriptEditor

scriptEditor.py

Platform:
Windows, Linux, Mac Os X.
Description:
Defines the ScriptEditor Component Interface class.

Others:

4.19.1. Module Attributes

umbra.components.factory.scriptEditor.scriptEditor.LOGGER
umbra.components.factory.scriptEditor.scriptEditor.COMPONENT_UI_FILE

4.19.2. Classes

class umbra.components.factory.scriptEditor.scriptEditor.ScriptEditor(parent=None, name=None, *args, **kwargs)[source]

Bases: manager.qwidgetComponent.QWidgetComponent

Defines the sibl_gui.components.addons.scriptEditor.scriptEditor Component Interface class.

Initializes the class.

Parameters:
  • parent (QObject) – Object parent.
  • name (unicode) – Component name.
  • *args (*) – Arguments.
  • **kwargs (**) – Keywords arguments.
uiRefresh

This signal is emited by the ScriptEditor class when the Ui needs to be refreshed. ( pyqtSignal )

recentFilesChanged

This signal is emited by the ScriptEditor class when the recent files list has changed. ( pyqtSignal )

fileLoaded

This signal is emited by the ScriptEditor class when a file is loaded. ( pyqtSignal )

Returns:Loaded file.
Return type:unicode
fileClosed

This signal is emited by the ScriptEditor class when a file is closed. ( pyqtSignal )

Returns:Closed file.
Return type:unicode
dockArea[source]

Property for self.__dockArea attribute.

Returns:self.__dockArea.
Return type:int
engine[source]

Property for self.__engine attribute.

Returns:self.__engine.
Return type:QObject
settings[source]

Property for self.__settings attribute.

Returns:self.__settings.
Return type:QSettings
settingsSection[source]

Property for self.__settingsSection attribute.

Returns:self.__settingsSection.
Return type:unicode
developmentLayout[source]

Property for self.__developmentLayout attribute.

Returns:self.__developmentLayout.
Return type:unicode
grammarsDirectory[source]

Property for self.__grammarsDirectory attribute.

Returns:self.__grammarsDirectory.
Return type:unicode
extension[source]

Property for self.__extension attribute.

Returns:self.__extension.
Return type:unicode
model[source]

Property for self.__model attribute.

Returns:self.__model.
Return type:ProjectsModel
languagesModel[source]

Property for self.__languagesModel attribute.

Returns:self.__languagesModel.
Return type:LanguagesModel
defaultProject[source]

Property for self.__defaultProject attribute.

Returns:self.__defaultProject.
Return type:unicode
defaultLanguage[source]

Property for self.__defaultLanguage attribute.

Returns:self.__defaultLanguage.
Return type:unicode
defaultScriptLanguage[source]

Property for self.__defaultScriptLanguage attribute.

Returns:self.__defaultScriptLanguage.
Return type:unicode
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
defaultWindowTitle[source]

Property for self.__defaultWindowTitle attribute.

Returns:self.__defaultWindowTitle.
Return type:unicode
defaultScriptEditorDirectory[source]

Property for self.__defaultScriptEditorDirectory attribute.

Returns:self.__defaultScriptEditorDirectory.
Return type:unicode
defaultSessionDirectory[source]

Property for self.__defaultSessionDirectory attribute.

Returns:self.__defaultSessionDirectory.
Return type:unicode
defaultScriptEditorFile[source]

Property for self.__defaultScriptEditorFile attribute.

Returns:self.__defaultScriptEditorFile.
Return type:unicode
factoryDefaultScriptEditorFile[source]

Property for self.__factoryDefaultScriptEditorFile attribute.

Returns:self.__factoryDefaultScriptEditorFile.
Return type:unicode
scriptEditorFile[source]

Property for self.__scriptEditorFile attribute.

Returns:self.__scriptEditorFile.
Return type:unicode
maximumRecentFiles[source]

Property for self.__maximumRecentFiles attribute.

Returns:self.__maximumRecentFiles.
Return type:int
recentFilesActions[source]

Property for self.__recentFilesActions attribute.

Returns:self.__recentFilesActions.
Return type:list
searchAndReplace[source]

Property for self.__searchAndReplace attribute.

Returns:self.__searchAndReplace.
Return type:SearchAndReplace
searchInFiles[source]

Property for self.__searchInFiles attribute.

Returns:self.__searchInFiles.
Return type:SearchInFiles
indentWidth[source]

Property for self.__indentWidth attribute.

Returns:self.__indentWidth.
Return type:int
defaultFontsSettings[source]

Property for self.__defaultFontsSettings attribute.

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

Property for self.__console attribute.

Returns:self.__console.
Return type:dict
memoryHandlerStackDepth[source]

Property for self.__memoryHandlerStackDepth attribute.

Returns:self.__memoryHandlerStackDepth.
Return type:int
menuBar[source]

Property for self.__menuBar attribute.

Returns:self.__menuBar.
Return type:QToolbar
fileMenu[source]

Property for self.__fileMenu attribute.

Returns:self.__fileMenu.
Return type:QMenu
editMenu[source]

Property for self.__editMenu attribute.

Returns:self.__editMenu.
Return type:QMenu
sourceMenu[source]

Property for self.__sourceMenu attribute.

Returns:self.__sourceMenu.
Return type:QMenu
navigateMenu[source]

Property for self.__navigateMenu attribute.

Returns:self.__navigateMenu.
Return type:QMenu
searchMenu[source]

Property for self.__searchMenu attribute.

Returns:self.__searchMenu.
Return type:QMenu
commandMenu[source]

Property for self.__commandMenu attribute.

Returns:self.__commandMenu.
Return type:QMenu
viewMenu[source]

Property for self.__viewMenu attribute.

Returns:self.__viewMenu.
Return type:QMenu
activate(engine)[source]

Activates the Component.

Parameters:engine (QObject) – Container to attach the Component to.
Returns:Method success.
Return type:bool
deactivate()[source]

Deactivates the Component.

Returns:Method success.
Return type:bool
initializeUi()[source]

Initializes the Component ui.

Returns:Method success.
Return type:bool
uninitializeUi()[source]

Uninitializes the Component ui.

Returns:Method success.
Return type:bool
addWidget()[source]

Adds the Component Widget to the engine.

Returns:Method success.
Return type:bool
removeWidget()[source]

Removes the Component Widget from the engine.

Returns:Method success.
Return type:bool
onStartup()[source]

Defines the slot triggered on Framework startup.

onClose()[source]

Defines the slot triggered on Framework close.

registerFile(file)[source]

Registers given file in the fileSystemEventsManager.

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

Unregisters given file in the fileSystemEventsManager.

Parameters:file (unicode) – File.
Returns:Method success.
Return type:bool
registerNodePath(node)[source]

Registers given Node path in the fileSystemEventsManager.

Parameters:node (FileNode or DirectoryNode or ProjectNode) – Node.
Returns:Method success.
Return type:bool
unregisterNodePath(node)[source]

Unregisters given Node path from the fileSystemEventsManager.

Parameters:node (FileNode or DirectoryNode or ProjectNode) – Node.
Returns:Method success.
Return type:bool
loadFileUi()[source]

Loads user chosen file(s) into Script_Editor_tabWidget Widget tab Model editor(s).

Returns:Method success.
Return type:bool
Note:May require user interaction.
addProjectUi()[source]

Adds user chosen project Script_Editor_tabWidget Widget tab Model.

Returns:Method success.
Return type:bool
Note:May require user interaction.
searchAndReplaceUi()[source]

Performs a search and replace in the current Script_Editor_tabWidget Widget tab Model editor.

Returns:Method success.
Return type:bool
Note:May require user interaction.
searchInFilesUi()[source]

Performs a search in the current user chosen files.

Returns:Method success.
Return type:bool
Note:May require user interaction.
getWidget(index)[source]

Returns the Script_Editor_tabWidget Widget associated with given index.

Parameters:index (int) – Tab index.
Returns:Widget.
Return type:QWidget
getFocusWidget()[source]

Returns the Widget with focus.

Returns:Widget with focus.
Return type:QWidget
getEditorTab(editor)[source]

Returns the Script_Editor_tabWidget Widget tab associated with the given editor.

Parameters:editor (Editor) – Editor to search tab for.
Returns:Tab index.
Return type:Editor
addEditorTab(editor)[source]

Adds a new tab to the Script_Editor_tabWidget Widget and sets the given editor as child widget.

Parameters:editor (Editor) – Editor.
Returns:New tab index.
Return type:int
removeEditorTab(editor)[source]

Removes the Script_Editor_tabWidget Widget tab with given editor.

Parameters:editor (Editor) – Editor.
Returns:Method success.
Return type:bool
findEditorTab(file)[source]

Finds the Script_Editor_tabWidget Widget tab associated to the given file.

Parameters:file (unicode) – File to search tab for.
Returns:Tab index.
Return type:Editor
hasEditorTab()[source]

Returns if the Script_Editor_tabWidget Widget has at least one tab.

Returns:Has tab.
Return type:bool
getCurrentEditor()[source]

Returns the current Script_Editor_tabWidget Widget tab Model editor.

Returns:Current editor.
Return type:Editor
setCurrentEditor(file)[source]

Focus the Script_Editor_tabWidget Widget tab Model editor with given file.

Parameters:file (unicode) – File.
Returns:Method success.
Return type:bool
loadPath(path)[source]

Loads given path.

Parameters:path (unicode) – Path to load.
Returns:Method success.
Return type:bool
loadDocument(document, file)[source]

Loads given document into a new Script_Editor_tabWidget Widget tab Model editor.

Parameters:
  • document (QTextDocument) – Document to load.
  • file (unicode) – Document file.
Returns:

Method success.

Return type:

bool

addProject(path)[source]

Adds a project.

Parameters:path (unicode) – Project path.
Returns:Method success.
Return type:bool
removeProject(path)[source]

Removes a project.

Parameters:path (unicode) – Project path.
Returns:Method success.
Return type:bool
newFile()[source]

Creates a new file into a new Script_Editor_tabWidget Widget tab.

Returns:Method success.
Return type:bool
loadFile(file)[source]

Loads user chosen file in a new Script_Editor_tabWidget Widget tab Model editor.

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

Reloads given file Script_Editor_tabWidget Widget tab Model editor content.

Parameters:
  • file (unicode) – File to reload.
  • isModified (bool) – File modified state.
Returns:

Method success.

Return type:

bool

saveFile(file=None)[source]

Saves either given file or current Script_Editor_tabWidget Widget tab Model editor file.

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

Saves current Script_Editor_tabWidget Widget tab Model editor file as user chosen file.

Returns:Method success.
Return type:bool
saveAllFiles()[source]

Saves all Script_Editor_tabWidget Widget tab Model editor files.

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

Reverts either given file or current Script_Editor_tabWidget Widget tab Model editor file.

Parameters:file (unicode) – File to revert.
Returns:Method success.
Return type:bool
closeFile(file=None, leaveFirstEditor=True)[source]

Closes either given file or current Script_Editor_tabWidget Widget tab Model editor file.

Parameters:
  • file (unicode) – File to save.
  • leaveFirstEditor (bool) – Leave first editor.
Returns:

Method success.

Return type:

bool

closeAllFiles(leaveFirstEditor=True)[source]

Closes every opened files and removes their associated Script_Editor_tabWidget Widget tabs.

Returns:Method success.
Return type:bool
closeFirstFile()[source]

Attemtps to close the first Script_Editor_tabWidget Widget tab Model editor file.

Returns:Method success.
Return type:bool
listEditors()[source]

Returns the Model editors.

Returns:Editors.
Return type:list
listFiles()[source]

Returns the Model files.

Returns:FileNode nodes.
Return type:list
listDirectories()[source]

Returns the Model directories.

Returns:DirectoryNode nodes.
Return type:list
listProjects(ignoreDefaultProject=True)[source]

Returns the Model projects.

Returns:ProjectNode nodes.
Return type:list
getEditor(file)[source]

Returns the Model editor associated with given file.

Parameters:file (unicode) – File to search editors for.
Returns:Editor.
Return type:Editor
setLanguage(editor, language)[source]

Sets given language to given Model editor.

Parameters:
  • editor (Editor) – Editor to set language to.
  • language (Language) – Language to set.
Returns:

Method success.

Return type:

bool

gotoLine()[source]

Moves current Script_Editor_tabWidget Widget tab Model editor cursor to user defined line.

Returns:Method success.
Return type:bool
Note:May require user interaction.
evaluateSelection()[source]

Evaluates current Script_Editor_tabWidget Widget tab Model editor selected content in the interactive console.

Returns:Method success.
Return type:bool
evaluateScript()[source]

Evaluates current Script_Editor_tabWidget Widget tab Model editor content into the interactive console.

Returns:Method success.
Return type:bool
evaluateCode(code)[source]

Evaluates given code into the interactive console.

Parameters:code (unicode) – Code to evaluate.
Returns:Method success.
Return type:bool
storeSession()[source]

Stores the current session.

Returns:Method success.
Return type:bool
restoreSession()[source]

Restores the stored session.

Returns:Method success.
Return type:bool
loopThroughEditors(backward=False)[source]

Loops through the editor tabs.

Parameters:backward (bool) – Looping backward.
Returns:Method success.
Return type:bool
restoreDevelopmentLayout()[source]

Restores the development layout.

Returns:Definition success.
Return type:bool