AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html

Tue, 10 Dec 2024 15:48:50 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 10 Dec 2024 15:48:50 +0100
branch
eric7
changeset 216
42ded9008f96
parent 206
0e83bc0cc7fd
permissions
-rw-r--r--

Updated copyright for 2025.

<!DOCTYPE html>
<html><head>
<title>Plugin_Assistant_Eric.AssistantEric.Assistant</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>Plugin_Assistant_Eric.AssistantEric.Assistant</h1>

<p>
Module implementing the eric assistant, an alternative autocompletion and
calltips system.
</p>
<h3>Global Attributes</h3>

<table>
<tr><td>AcsAPIs</td></tr><tr><td>AcsDocument</td></tr><tr><td>AcsProject</td></tr>
</table>
<h3>Classes</h3>

<table>

<tr>
<td><a href="#Assistant">Assistant</a></td>
<td>Class implementing the autocompletion and calltips system.</td>
</tr>
</table>
<h3>Functions</h3>

<table>
<tr><td>None</td></tr>
</table>
<hr />
<hr />
<a NAME="Assistant" ID="Assistant"></a>
<h2>Assistant</h2>

<p>
    Class implementing the autocompletion and calltips system.
</p>
<h3>Derived from</h3>
QObject
<h3>Class Attributes</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Class Methods</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>

<table>

<tr>
<td><a href="#Assistant.__init__">Assistant</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#Assistant.__editorClosed">__editorClosed</a></td>
<td>Private slot called, when an editor was closed.</td>
</tr>
<tr>
<td><a href="#Assistant.__editorOpened">__editorOpened</a></td>
<td>Private slot called, when a new editor was opened.</td>
</tr>
<tr>
<td><a href="#Assistant.__getApiCalltips">__getApiCalltips</a></td>
<td>Private method to determine calltips from APIs.</td>
</tr>
<tr>
<td><a href="#Assistant.__getApiCompletions">__getApiCompletions</a></td>
<td>Private method to determine a list of completions from an API object.</td>
</tr>
<tr>
<td><a href="#Assistant.__getCompletions">__getCompletions</a></td>
<td>Private method to get the list of possible completions.</td>
</tr>
<tr>
<td><a href="#Assistant.__getDocumentCalltips">__getDocumentCalltips</a></td>
<td>Private method to determine calltips from the document.</td>
</tr>
<tr>
<td><a href="#Assistant.__getDocumentCompletions">__getDocumentCompletions</a></td>
<td>Private method to determine autocompletion proposals from the document.</td>
</tr>
<tr>
<td><a href="#Assistant.__getProjectType">__getProjectType</a></td>
<td>Private method to determine the project type to be used.</td>
</tr>
<tr>
<td><a href="#Assistant.__preferencesChanged">__preferencesChanged</a></td>
<td>Private method to handle a change of the global configuration.</td>
</tr>
<tr>
<td><a href="#Assistant.__recordSelectedContext">__recordSelectedContext</a></td>
<td>Private slot to handle the selection from the completion list to record the selected completion context.</td>
</tr>
<tr>
<td><a href="#Assistant.__setAutoCompletionHook">__setAutoCompletionHook</a></td>
<td>Private method to set the autocompletion hook.</td>
</tr>
<tr>
<td><a href="#Assistant.__setCalltipsHook">__setCalltipsHook</a></td>
<td>Private method to set the calltip hook.</td>
</tr>
<tr>
<td><a href="#Assistant.__shutdown">__shutdown</a></td>
<td>Private slot to handle the shutdown signal.</td>
</tr>
<tr>
<td><a href="#Assistant.__unsetAutoCompletionHook">__unsetAutoCompletionHook</a></td>
<td>Private method to unset the autocompletion hook.</td>
</tr>
<tr>
<td><a href="#Assistant.__unsetCalltipsHook">__unsetCalltipsHook</a></td>
<td>Private method to unset the calltip hook.</td>
</tr>
<tr>
<td><a href="#Assistant.activate">activate</a></td>
<td>Public method to perform actions upon activation.</td>
</tr>
<tr>
<td><a href="#Assistant.calltips">calltips</a></td>
<td>Public method to return a list of calltips.</td>
</tr>
<tr>
<td><a href="#Assistant.deactivate">deactivate</a></td>
<td>Public method to perform actions upon deactivation.</td>
</tr>
<tr>
<td><a href="#Assistant.getCompletionsList">getCompletionsList</a></td>
<td>Public method to get a list of possible completions.</td>
</tr>
<tr>
<td><a href="#Assistant.setEnabled">setEnabled</a></td>
<td>Public method to enable or disable a feature.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="Assistant.__init__" ID="Assistant.__init__"></a>
<h4>Assistant (Constructor)</h4>
<b>Assistant</b>(<i>plugin, parent=None</i>)

<p>
        Constructor
</p>
<dl>

<dt><i>plugin</i> (AssistantEricPlugin)</dt>
<dd>
reference to the plugin object
</dd>
<dt><i>parent</i> (QObject)</dt>
<dd>
parent
</dd>
</dl>
<a NAME="Assistant.__editorClosed" ID="Assistant.__editorClosed"></a>
<h4>Assistant.__editorClosed</h4>
<b>__editorClosed</b>(<i>editor</i>)

<p>
        Private slot called, when an editor was closed.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor
</dd>
</dl>
<a NAME="Assistant.__editorOpened" ID="Assistant.__editorOpened"></a>
<h4>Assistant.__editorOpened</h4>
<b>__editorOpened</b>(<i>editor</i>)

<p>
        Private slot called, when a new editor was opened.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the new editor
</dd>
</dl>
<a NAME="Assistant.__getApiCalltips" ID="Assistant.__getApiCalltips"></a>
<h4>Assistant.__getApiCalltips</h4>
<b>__getApiCalltips</b>(<i>api, word, commas, prefix, module, editor</i>)

<p>
        Private method to determine calltips from APIs.
</p>
<dl>

<dt><i>api</i> (APIsManager.DbAPIs)</dt>
<dd>
reference to the API object to be used
</dd>
<dt><i>word</i> (str)</dt>
<dd>
function to get calltips for
</dd>
<dt><i>commas</i> (int)</dt>
<dd>
minimum number of commas contained in the calltip
</dd>
<dt><i>prefix</i> (str)</dt>
<dd>
prefix of the word to be completed
</dd>
<dt><i>module</i> (Module)</dt>
<dd>
reference to the scanned module info
</dd>
<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor object
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of calltips
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="Assistant.__getApiCompletions" ID="Assistant.__getApiCompletions"></a>
<h4>Assistant.__getApiCompletions</h4>
<b>__getApiCompletions</b>(<i>api, word, context, prefix, module, editor</i>)

<p>
        Private method to determine a list of completions from an API object.
</p>
<dl>

<dt><i>api</i> (APIsManager.DbAPIs)</dt>
<dd>
reference to the API object to be used
</dd>
<dt><i>word</i> (str)</dt>
<dd>
word (or wordpart) to complete
</dd>
<dt><i>context</i> (bool)</dt>
<dd>
flag indicating to autocomplete a context
</dd>
<dt><i>prefix</i> (str)</dt>
<dd>
prefix of the word to be completed
</dd>
<dt><i>module</i> (Module)</dt>
<dd>
reference to the scanned module info
</dd>
<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor object
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of possible completions
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="Assistant.__getCompletions" ID="Assistant.__getCompletions"></a>
<h4>Assistant.__getCompletions</h4>
<b>__getCompletions</b>(<i>word, context, prefix, language, projectType, module, editor, importCompletion, documentOnly, sep, </i>)

<p>
        Private method to get the list of possible completions.
</p>
<dl>

<dt><i>word</i> (str)</dt>
<dd>
word (or wordpart) to complete
</dd>
<dt><i>context</i> (bool)</dt>
<dd>
flag indicating to autocomplete a context
</dd>
<dt><i>prefix</i> (str)</dt>
<dd>
prefix of the word to be completed
</dd>
<dt><i>language</i> (str)</dt>
<dd>
programming language of the source
</dd>
<dt><i>projectType</i> (str)</dt>
<dd>
type of the project
</dd>
<dt><i>module</i> (Module)</dt>
<dd>
reference to the scanned module info
</dd>
<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor object
</dd>
<dt><i>importCompletion</i> (bool)</dt>
<dd>
flag indicating an import completion
</dd>
<dt><i>documentOnly</i> (bool)</dt>
<dd>
flag indicating to complete from the document only
</dd>
<dt><i>sep</i> (str)</dt>
<dd>
separator string
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of possible completions
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="Assistant.__getDocumentCalltips" ID="Assistant.__getDocumentCalltips"></a>
<h4>Assistant.__getDocumentCalltips</h4>
<b>__getDocumentCalltips</b>(<i>word, prefix, module, editor, doHierarchy=False</i>)

<p>
        Private method to determine calltips from the document.
</p>
<dl>

<dt><i>word</i> (str)</dt>
<dd>
function to get calltips for
</dd>
<dt><i>prefix</i> (str)</dt>
<dd>
prefix of the word to be completed
</dd>
<dt><i>module</i> (Module)</dt>
<dd>
reference to the scanned module info
</dd>
<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor object
</dd>
<dt><i>doHierarchy</i> (bool)</dt>
<dd>
flag indicating a hierarchical search
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of calltips
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="Assistant.__getDocumentCompletions" ID="Assistant.__getDocumentCompletions"></a>
<h4>Assistant.__getDocumentCompletions</h4>
<b>__getDocumentCompletions</b>(<i>editor, word, context, sep, prefix, module, doHierarchy=False</i>)

<p>
        Private method to determine autocompletion proposals from the document.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor object
</dd>
<dt><i>word</i> (str)</dt>
<dd>
string to be completed
</dd>
<dt><i>context</i> (bool)</dt>
<dd>
flag indicating to autocomplete a context
</dd>
<dt><i>sep</i> (str)</dt>
<dd>
separator string
</dd>
<dt><i>prefix</i> (str)</dt>
<dd>
prefix of the word to be completed
</dd>
<dt><i>module</i> (Module)</dt>
<dd>
reference to the scanned module info
</dd>
<dt><i>doHierarchy</i> (bool)</dt>
<dd>
flag indicating a hierarchical search
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of possible completions
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="Assistant.__getProjectType" ID="Assistant.__getProjectType"></a>
<h4>Assistant.__getProjectType</h4>
<b>__getProjectType</b>(<i>editor</i>)

<p>
        Private method to determine the project type to be used.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor to check
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
project type
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="Assistant.__preferencesChanged" ID="Assistant.__preferencesChanged"></a>
<h4>Assistant.__preferencesChanged</h4>
<b>__preferencesChanged</b>(<i></i>)

<p>
        Private method to handle a change of the global configuration.
</p>
<a NAME="Assistant.__recordSelectedContext" ID="Assistant.__recordSelectedContext"></a>
<h4>Assistant.__recordSelectedContext</h4>
<b>__recordSelectedContext</b>(<i>userListId, txt</i>)

<p>
        Private slot to handle the selection from the completion list to
        record the selected completion context.
</p>
<dl>

<dt><i>userListId</i> (int)</dt>
<dd>
the ID of the user list (should be 1)
</dd>
<dt><i>txt</i> (str)</dt>
<dd>
the selected text
</dd>
</dl>
<a NAME="Assistant.__setAutoCompletionHook" ID="Assistant.__setAutoCompletionHook"></a>
<h4>Assistant.__setAutoCompletionHook</h4>
<b>__setAutoCompletionHook</b>(<i>editor</i>)

<p>
        Private method to set the autocompletion hook.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor
</dd>
</dl>
<a NAME="Assistant.__setCalltipsHook" ID="Assistant.__setCalltipsHook"></a>
<h4>Assistant.__setCalltipsHook</h4>
<b>__setCalltipsHook</b>(<i>editor</i>)

<p>
        Private method to set the calltip hook.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor
</dd>
</dl>
<a NAME="Assistant.__shutdown" ID="Assistant.__shutdown"></a>
<h4>Assistant.__shutdown</h4>
<b>__shutdown</b>(<i></i>)

<p>
        Private slot to handle the shutdown signal.
</p>
<a NAME="Assistant.__unsetAutoCompletionHook" ID="Assistant.__unsetAutoCompletionHook"></a>
<h4>Assistant.__unsetAutoCompletionHook</h4>
<b>__unsetAutoCompletionHook</b>(<i>editor</i>)

<p>
        Private method to unset the autocompletion hook.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor
</dd>
</dl>
<a NAME="Assistant.__unsetCalltipsHook" ID="Assistant.__unsetCalltipsHook"></a>
<h4>Assistant.__unsetCalltipsHook</h4>
<b>__unsetCalltipsHook</b>(<i>editor</i>)

<p>
        Private method to unset the calltip hook.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor
</dd>
</dl>
<a NAME="Assistant.activate" ID="Assistant.activate"></a>
<h4>Assistant.activate</h4>
<b>activate</b>(<i></i>)

<p>
        Public method to perform actions upon activation.
</p>
<a NAME="Assistant.calltips" ID="Assistant.calltips"></a>
<h4>Assistant.calltips</h4>
<b>calltips</b>(<i>editor, pos, commas</i>)

<p>
        Public method to return a list of calltips.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor
</dd>
<dt><i>pos</i> (int)</dt>
<dd>
position in the text for the calltip
</dd>
<dt><i>commas</i> (int)</dt>
<dd>
minimum number of commas contained in the calltip
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of possible calltips
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="Assistant.deactivate" ID="Assistant.deactivate"></a>
<h4>Assistant.deactivate</h4>
<b>deactivate</b>(<i></i>)

<p>
        Public method to perform actions upon deactivation.
</p>
<a NAME="Assistant.getCompletionsList" ID="Assistant.getCompletionsList"></a>
<h4>Assistant.getCompletionsList</h4>
<b>getCompletionsList</b>(<i>editor, context</i>)

<p>
        Public method to get a list of possible completions.
</p>
<dl>

<dt><i>editor</i> (Editor)</dt>
<dd>
reference to the editor object, that called this method
</dd>
<dt><i>context</i> (bool)</dt>
<dd>
flag indicating to autocomplete a context
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
list of possible completions
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="Assistant.setEnabled" ID="Assistant.setEnabled"></a>
<h4>Assistant.setEnabled</h4>
<b>setEnabled</b>(<i>key, enabled, </i>)

<p>
        Public method to enable or disable a feature.
</p>
<dl>

<dt><i>key</i> (str)</dt>
<dd>
feature to set
</dd>
<dt><i>enabled</i> (bool)</dt>
<dd>
flag indicating the status
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial