4.17. umbra.components.factory.scriptEditor.models

models.py

Platform:
Windows, Linux, Mac Os X.
Description:
Defines the umbra.components.factory.scriptEditor.scriptEditor.ScriptEditor Component Interface class Models.

Others:

4.17.1. Module Attributes

umbra.components.factory.scriptEditor.models.LOGGER

4.17.2. Classes

class umbra.components.factory.scriptEditor.models.ProjectsModel(parent=None, rootNode=None, horizontalHeaders=None, verticalHeaders=None, defaultNode=None, defaultProject=None)[source]

Bases: umbra.ui.models.GraphModel

Defines the Model used by umbra.components.factory.scriptEditor.scriptEditor.ScriptEditor Component Interface class.

Initializes the class.

Parameters:
  • defaultProject (unicode) – Default project name.
  • parent (QObject) – Object parent.
  • rootNode (AbstractCompositeNode) – Root node.
  • horizontalHeaders (OrderedDict) – Headers.
  • verticalHeaders (OrderedDict) – Headers.
  • defaultNode (GraphModelNode) – Default node.
fileRegistered

This signal is emited by the ProjectsModel class when a file is registered. ( pyqtSignal )

Returns:Registered file FileNode.
Return type:FileNode
fileUnregistered

This signal is emited by the ProjectsModel class when a file is unregistered. ( pyqtSignal )

Returns:Unregistered file FileNode.
Return type:FileNode
editorRegistered

This signal is emited by the ProjectsModel class when an editor is registered. ( pyqtSignal )

Returns:Registered editor EditorNode.
Return type:EditorNode
editorUnregistered

This signal is emited by the ProjectsModel class when an editor is unregistered. ( pyqtSignal )

Returns:Unregistered editor EditorNode.
Return type:EditorNode
directoryRegistered

This signal is emited by the ProjectsModel class when a directory is registered. ( pyqtSignal )

Returns:Registered directory DirectoryNode.
Return type:DirectoryNode
directoryUnregistered

This signal is emited by the ProjectsModel class when a directory is unregistered. ( pyqtSignal )

Returns:Unregistered directory DirectoryNode.
Return type:DirectoryNode
projectRegistered

This signal is emited by the ProjectsModel class when a project is registered. ( pyqtSignal )

Returns:Registered project ProjectNode.
Return type:ProjectNode
projectUnregistered

This signal is emited by the ProjectsModel class when a project is unregistered. ( pyqtSignal )

Returns:Unregistered project ProjectNode.
Return type:ProjectNode
defaultProject[source]

Property for self.__defaultProject attribute.

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

Property for self.__defaultProjectNode attribute.

Returns:self.__defaultProjectNode.
Return type:unicode
listEditorNodes(node=None)[source]

Returns the Model umbra.components.factory.scriptEditor.nodes.EditorNode class nodes.

Parameters:node (AbstractNode or AbstractCompositeNode or Object) – Node to start walking from.
Returns:EditorNode nodes.
Return type:list
listFileNodes(node=None)[source]

Returns the Model umbra.components.factory.scriptEditor.nodes.FileNode class nodes.

Parameters:node (AbstractNode or AbstractCompositeNode or Object) – Node to start walking from.
Returns:FileNode nodes.
Return type:list
listDirectoryNodes()[source]

Returns the Model umbra.components.factory.scriptEditor.nodes.DirectoryNode class nodes.

Returns:DirectoryNode nodes.
Return type:list
listProjectNodes(ignoreDefaultProjectNode=True)[source]

Returns the Model umbra.components.factory.scriptEditor.nodes.ProjectNode class nodes.

Parameters:ignoreDefaultProjectNode (bool) – Default ProjectNode will be ignored.
Returns:ProjectNode nodes.
Return type:list
listEditors(node=None)[source]

Returns the Model editors.

Parameters:node (AbstractNode or AbstractCompositeNode or Object) – Node to start walking from.
Returns:Editors.
Return type:list
listFiles(node=None)[source]

Returns the Model files.

Parameters:node (AbstractNode or AbstractCompositeNode or Object) – Node to start walking from.
Returns:FileNode nodes.
Return type:list
listDirectories()[source]

Returns the Model directories.

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

Returns the Model projects.

Parameters:ignoreDefaultProjectNode (bool) – Default ProjectNode will be ignored.
Returns:ProjectNode nodes.
Return type:list
getEditorNodes(editor, node=None)[source]

Returns the umbra.components.factory.scriptEditor.nodes.EditorNode class Nodes with given editor.

Parameters:
  • node (AbstractNode or AbstractCompositeNode or Object) – Node to start walking from.
  • editor (Editor) – Editor.
Returns:

EditorNode nodes.

Return type:

list

getFileNodes(path, node=None)[source]

Returns the umbra.components.factory.scriptEditor.nodes.FileNode class Nodes with given path.

Parameters:
  • node (AbstractNode or AbstractCompositeNode or Object) – Node to start walking from.
  • path (unicode) – File path.
Returns:

FileNode nodes.

Return type:

list

getDirectoryNodes(path)[source]

Returns the umbra.components.factory.scriptEditor.nodes.DirectoryNode class Nodes with given path.

Parameters:path (unicode) – Directory path.
Returns:DirectoryNode nodes.
Return type:list
getProjectNodes(path)[source]

Returns the umbra.components.factory.scriptEditor.nodes.ProjectNode class Nodes with given path.

Parameters:path (unicode) – Project path.
Returns:ProjectNode nodes.
Return type:list
moveNode(parent, fromIndex, toIndex)[source]

Moves given parent child to given index.

Parameters:
  • toIndex (int) – Index to.
  • fromIndex (int) – Index from.
Returns:

Method success.

Return type:

bool

registerFile(file, parent, ensureUniqueness=False)[source]

Registers given file in the Model.

Parameters:
  • file (unicode) – File to register.
  • parent (GraphModelNode) – FileNode parent.
  • ensureUniqueness (bool) – Ensure registrar uniqueness.
Returns:

FileNode.

Return type:

FileNode

unregisterFile(fileNode, raiseException=False)[source]

Unregisters given umbra.components.factory.scriptEditor.nodes.FileNode class Node from the Model.

Parameters:
  • fileNode (FileNode) – FileNode to unregister.
  • raiseException (bool) – Raise the exception.
Returns:

FileNode.

Return type:

FileNode

registerDirectory(directory, parent, ensureUniqueness=False)[source]

Registers given directory in the Model.

Parameters:
  • directory (unicode) – Directory to register.
  • parent (GraphModelNode) – DirectoryNode parent.
  • ensureUniqueness (bool) – Ensure registrar uniqueness.
Returns:

DirectoryNode.

Return type:

DirectoryNode

unregisterDirectory(directoryNode, raiseException=False)[source]

Unregisters given umbra.components.factory.scriptEditor.nodes.DirectoryNode class Node from the Model.

Parameters:
  • directoryNode (DirectoryNode) – DirectoryNode to unregister.
  • raiseException (bool) – Raise the exception.
Returns:

DirectoryNode.

Return type:

DirectoryNode

registerEditor(editor, parent, ensureUniqueness=False)[source]

Registers given umbra.components.factory.scriptEditor.editor.Editor class editor in the Model.

Parameters:
  • editor (Editor) – Editor to register.
  • parent (GraphModelNode) – EditorNode parent.
  • ensureUniqueness (bool) – Ensure registrar uniqueness.
Returns:

EditorNode.

Return type:

EditorNode

unregisterEditor(editorNode, raiseException=False)[source]

Unregisters given umbra.components.factory.scriptEditor.nodes.EditorNode class Node from the Model.

Parameters:
  • editorNode (EditorNode) – EditorNode to unregister.
  • raiseException (bool) – Raise the exception.
Returns:

EditorNode.

Return type:

EditorNode

registerProject(path, ensureUniqueness=False)[source]

Registers given path in the Model as a project.

Parameters:
  • path (unicode) – Project path to register.
  • ensureUniqueness (bool) – Ensure registrar uniqueness.
Returns:

ProjectNode.

Return type:

ProjectNode

unregisterProject(projectNode, raiseException=False)[source]

Unregisters given umbra.components.factory.scriptProject.nodes.ProjectNode class Node from the Model.

Parameters:
  • projectNode (ProjectNode) – ProjectNode to unregister.
  • raiseException (bool) – Raise the exception.
Returns:

ProjectNode.

Return type:

ProjectNode

isAuthoringNode(node)[source]

Returns if given Node is an authoring node.

Parameters:node (ProjectNode or DirectoryNode or FileNode) – Node.
Returns:Is authoring node.
Return type:bool
setAuthoringNodes(editor)[source]

Sets the Model authoring Nodes using given editor.

Parameters:editor (Editor) – Editor to set.
Returns:Method success.
Return type:bool
deleteAuthoringNodes(editor)[source]

Deletes the Model authoring Nodes associated with given editor.

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

Updates given editor Model authoring nodes.

Parameters:editor (Editor) – Editor.
Returns:Method success.
Return type:bool
setProjectNodes(rootNode, maximumDepth=1)[source]

Sets the project Model children Nodes using given root node.

Parameters:
  • rootNode (ProjectNode or DirectoryNode) – Root node.
  • maximumDepth (int) – Maximum nodes nesting depth.
deleteProjectNodes(node)[source]

Deletes the Model project Nodes associated with given node.

Parameters:node (ProjectNode) – Node.
unregisterProjectNodes(node)[source]

Unregisters given Node children.

Parameters:node (ProjectNode or DirectoryNode) – Node.
updateProjectNodes(node)[source]

Updates given root Node children.

Parameters:node (ProjectNode or DirectoryNode) – Node.
class umbra.components.factory.scriptEditor.models.LanguagesModel(parent=None, languages=None)[source]

Bases: PyQt4.QtCore.QAbstractListModel

Defines a QAbstractListModel subclass used to store the umbra.components.factory.scriptEditor.scriptEditor.ScriptEditor Component Interface class languages.

Initializes the class.

Parameters:
  • parent (QObject) – Parent object.
  • languages (list) – Languages.
languages[source]

Property for self.__languages attribute.

Returns:self.__languages.
Return type:list
rowCount(parent=<PyQt4.QtCore.QModelIndex object at 0x10274ede8>)[source]

Reimplements the QAbstractListModel.rowCount() method.

Parameters:parent (QModelIndex) – Parent.
Returns:Row count.
Return type:int
data(index, role=0)[source]

Reimplements the QAbstractListModel.data() method.

Parameters:
  • index (QModelIndex) – Index.
  • role (int) – Role.
Returns:

Data.

Return type:

QVariant

sortLanguages(order=0)[source]

Sorts the Model languages.

Parameters:order – Order. ( Qt.SortOrder )
registerLanguage(language)[source]

Registers given language in the LanguagesModel.languages class property.

Parameters:language (Language) – Language to register.
Returns:Method success.
Return type:bool
unregisterLanguage(name)[source]

Unregisters language with given name from the LanguagesModel.languages class property.

Parameters:name (unicode) – Language to unregister.
Returns:Method success.
Return type:bool
getLanguage(name)[source]

Returns the language with given name.

Parameters:name (unicode) – Language name.
Returns:File language.
Return type:Language
getFileLanguage(file)[source]

Returns the language of given file.

Parameters:file (unicode) – File to get language of.
Returns:File language.
Return type:Language
class umbra.components.factory.scriptEditor.models.PatternsModel(parent=None, rootNode=None, horizontalHeaders=None, verticalHeaders=None)[source]

Bases: umbra.ui.models.GraphModel

Defines the Model used the by umbra.patterns.factory.scriptEditor.searchAndReplace.SearchAndReplace class to store the search and replace patterns.

Initializes the class.

Parameters:
  • parent (QObject) – Object parent.
  • rootNode (AbstractCompositeNode) – Root node.
  • horizontalHeaders (OrderedDict) – Headers.
  • verticalHeaders (OrderedDict) – Headers.
patternInserted

This signal is emited by the PatternsModel class when a pattern has been inserted. ( pyqtSignal )

Returns:Inserted pattern node.
Return type:PatternNode
patternRemoved

This signal is emited by the PatternsModel class when a pattern has been removed. ( pyqtSignal )

Returns:Removed pattern node.
Return type:PatternNode
initializeModel(rootNode)[source]

Initializes the Model using given root node.

Parameters:rootNode (DefaultNode) – Graph root node.
Returns:Method success
Return type:bool
insertPattern(pattern, index)[source]

Inserts given pattern into the Model.

Parameters:
  • pattern (unicode) – Pattern.
  • index (int) – Insertion index.
Returns:

Method success.

Return type:

bool

removePattern(pattern)[source]

Removes given pattern from the Model.

Parameters:pattern (unicode) – Pattern.
Returns:Method success.
Return type:bool
class umbra.components.factory.scriptEditor.models.SearchResultsModel(parent=None, rootNode=None, horizontalHeaders=None, verticalHeaders=None, defaultNode=None)[source]

Bases: umbra.ui.models.GraphModel

Defines the Model used the by umbra.patterns.factory.scriptEditor.searchInFiles.SearchInFiles class to store the search results.

Initializes the class.

Parameters:
  • parent (QObject) – Object parent.
  • rootNode (AbstractCompositeNode) – Root node.
  • horizontalHeaders (OrderedDict) – Headers.
  • verticalHeaders (OrderedDict) – Headers.
  • defaultNode (GraphModelNode) – Default node.
initializeModel(rootNode)[source]

Initializes the Model using given root node.

Parameters:rootNode (DefaultNode) – Graph root node.
Returns:Method success
Return type:bool
getMetrics()[source]

Returns the Model metrics.

Returns:Nodes metrics.
Return type:dict