Plugin_Assistant_Eric.AssistantEric.APIsManager

Module implementing the APIsManager.

Global Attributes

ApisNameProject
WorkerAborted
WorkerFinished
WorkerStarted

Classes

APIsManager Class implementing the APIsManager class, which is the central store for API information used by autocompletion and calltips.
DbAPIs Class implementing an API storage entity.
DbAPIsWorker Class implementing a worker thread to prepare the API database.

Functions

None


APIsManager

Class implementing the APIsManager class, which is the central store for API information used by autocompletion and calltips.

Derived from

QObject

Class Attributes

None

Methods

APIsManager Constructor
deactivate Public method to perform actions upon deactivation.
getAPIs Public method to get an apis object for autocompletion/calltips.
reloadAPIs Public slot to reload the api information.

APIsManager (Constructor)

APIsManager(parent = None)

Constructor

parent
reference to the parent object (QObject)

APIsManager.deactivate

deactivate()

Public method to perform actions upon deactivation.

APIsManager.getAPIs

getAPIs(language)

Public method to get an apis object for autocompletion/calltips.

This method creates and loads an APIs object dynamically upon request. This saves memory for languages, that might not be needed at the moment.

language
the language of the requested api object (string or QString)
Returns:
the apis object (APIs)

APIsManager.reloadAPIs

reloadAPIs()

Public slot to reload the api information.

Up


DbAPIs

Class implementing an API storage entity.

Signals

apiPreparationCancelled()
emitted after the API preparation has been cancelled
apiPreparationFinished()
emitted after the API preparation has finished
apiPreparationStarted()
emitted after the API preparation has started

Derived from

QObject

Class Attributes

ac_context_stmt
ac_stmt
api_files_stmt
create_acWord_idx
create_api_stmt
create_context_idx
create_file_idx
create_file_stmt
create_fullContext_idx
create_mgmt_stmt
ct_context_stmt
ct_fullContext_stmt
ct_stmt
drop_acWord_idx
drop_api_stmt
drop_context_idx
drop_file_idx
drop_file_stmt
drop_fullContext_idx
drop_mgmt_stmt
format_select_stmt
mgmt_insert_stmt

Methods

DbAPIs Constructor
__createApiDB Private method to create an API database.
__enoughCommas Private method to determine, if the given string contains enough commas.
__initAsLanguage Private method to initialize as a language API object.
__initAsProject Private method to initialize as a project API object.
__isPrepared Private method to check, if the database has been prepared.
__openAPIs Private method to open the API database.
__openApiDb Private method to open the API database.
__processQueue Private slot to process the queue of files to load.
__projectClosed Private slot to perform actions after a project has been closed.
__projectOpened Private slot to perform actions after a project has been opened.
_apiDbName Protected method to determine the name of the database file.
autoCompletionWordSeparators Private method to get the word separator characters.
close Public method to close the database.
editorSaved Public slot to handle the editorSaved signal.
event Protected method to handle events from the worker thread.
getApiFiles Public method to get a list of API files loaded into the database.
getCalltips Public method to determine the calltips.
getCompletions Public method to determine the possible completions.
getLexer Public method to return a reference to our lexer object.
prepareAPIs Public method to prepare the APIs if neccessary.

DbAPIs (Constructor)

DbAPIs(language, parent = None)

Constructor

language
language of the APIs object (string)
parent
reference to the parent object (QObject)

DbAPIs.__createApiDB

__createApiDB()

Private method to create an API database.

DbAPIs.__enoughCommas

__enoughCommas(s, commas)

Private method to determine, if the given string contains enough commas.

s
string to check (string or QString)
commas
number of commas to check for (integer)
Returns:
flag indicating, that there are enough commas (boolean)

DbAPIs.__initAsLanguage

__initAsLanguage()

Private method to initialize as a language API object.

DbAPIs.__initAsProject

__initAsProject()

Private method to initialize as a project API object.

DbAPIs.__isPrepared

__isPrepared()

Private method to check, if the database has been prepared.

Returns:
flag indicating the prepared status (boolean)

DbAPIs.__openAPIs

__openAPIs()

Private method to open the API database.

DbAPIs.__openApiDb

__openApiDb()

Private method to open the API database.

DbAPIs.__processQueue

__processQueue()

Private slot to process the queue of files to load.

DbAPIs.__projectClosed

__projectClosed()

Private slot to perform actions after a project has been closed.

DbAPIs.__projectOpened

__projectOpened()

Private slot to perform actions after a project has been opened.

DbAPIs._apiDbName

_apiDbName()

Protected method to determine the name of the database file.

Returns:
name of the database file (string)

DbAPIs.autoCompletionWordSeparators

autoCompletionWordSeparators()

Private method to get the word separator characters.

Returns:
word separator characters (list of strings)

DbAPIs.close

close()

Public method to close the database.

DbAPIs.editorSaved

editorSaved(filename)

Public slot to handle the editorSaved signal.

filename
name of the file that was saved (string)

DbAPIs.event

event(evt)

Protected method to handle events from the worker thread.

evt
reference to the event object (QEvent)
Returns:
flag indicating, if the event was handled (boolean)

DbAPIs.getApiFiles

getApiFiles()

Public method to get a list of API files loaded into the database.

Returns:
list of API filenames (list of QString)

DbAPIs.getCalltips

getCalltips(acWord, commas, context = None, fullContext = None, showContext = True)

Public method to determine the calltips.

acWord
function to get calltips for (string or QString)
commas
minimum number of commas contained in the calltip (integer)
context
string giving the context (e.g. classname) (QString)
fullContext
string giving the full context (QString)
showContext
flag indicating to show the calltip context (boolean)
Returns:
list of calltips (list of string)

DbAPIs.getCompletions

getCompletions(start = None, context = None)

Public method to determine the possible completions.

start=
string giving the start of the word to be completed (string or QString)
context=
string giving the context (e.g. classname) to be completed (string or QString)
Returns:
list of dictionaries with possible completions (key 'completion' contains the completion (QString), key 'context' contains the context (QString) and key 'pictureId' contains the ID of the icon to be shown (QString))

DbAPIs.getLexer

getLexer()

Public method to return a reference to our lexer object.

Returns:
reference to the lexer object (QScintilla.Lexers.Lexer)

DbAPIs.prepareAPIs

prepareAPIs(rawList = None)

Public method to prepare the APIs if neccessary.

rawList=
list of raw API files (QStringList)
Up


DbAPIsWorker

Class implementing a worker thread to prepare the API database.

Derived from

QThread

Class Attributes

file_delete_id_stmt
file_id_stmt
file_loaded_stmt
populate_api_stmt
populate_del_api_stmt
populate_file_stmt
update_file_stmt

Methods

DbAPIsWorker Constructor
__autoCompletionWordSeparators Private method to get the word separator characters for a language.
__deleteApiFile Private method to delete all references to an api file.
__loadApiFile Private method to read a raw API file into the database.
__loadApiFileIfNewer Private method to load an API file, if it is newer than the open read into the database.
__storeApis Private method to put the API entries into the database.
abort Public method to ask the thread to stop.
run Public method to perform the threads work.

DbAPIsWorker (Constructor)

DbAPIsWorker(proxy, language, apiFiles, projectPath = "")

Constructor

proxy
reference to the object that is proxied (DbAPIs)
language
language of the APIs object (string)
apiFiles
list of API files to process (list of strings)
projectPath
path of the project. Only needed, if the APIs are extracted out of the sources of a project. (string)

DbAPIsWorker.__autoCompletionWordSeparators

__autoCompletionWordSeparators(language)

Private method to get the word separator characters for a language.

language
language of the APIs object (string)
Returns:
word separator characters (list of strings)

DbAPIsWorker.__deleteApiFile

__deleteApiFile(apiFile)

Private method to delete all references to an api file.

apiFile
filename of the raw API file (string or QString)

DbAPIsWorker.__loadApiFile

__loadApiFile(apiFile)

Private method to read a raw API file into the database.

apiFile
filename of the raw API file (string or QString)

DbAPIsWorker.__loadApiFileIfNewer

__loadApiFileIfNewer(apiFile)

Private method to load an API file, if it is newer than the open read into the database.

apiFile
filename of the raw API file (string or QString)

DbAPIsWorker.__storeApis

__storeApis(apis, apiFile, language)

Private method to put the API entries into the database.

apis
list of api entries (list of strings)
apiFile
filename of the file read to get the APIs (string or QString)
language
programming language of the file of the APIs (string)

DbAPIsWorker.abort

abort()

Public method to ask the thread to stop.

DbAPIsWorker.run

run()

Public method to perform the threads work.

Up