Added support for project type specific API configurations. release-3.2.0

Sat, 03 Dec 2016 18:08:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 03 Dec 2016 18:08:44 +0100
changeset 131
7d868e8e1cfb
parent 130
08c7aece376c
child 132
eb12cd27384f

Added support for project type specific API configurations.

AssistantEric/APIsManager.py file | annotate | diff | comparison | revisions
AssistantEric/Assistant.py file | annotate | diff | comparison | revisions
AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.APIsManager.html file | annotate | diff | comparison | revisions
AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html file | annotate | diff | comparison | revisions
ChangeLog file | annotate | diff | comparison | revisions
PluginAssistantEric.py file | annotate | diff | comparison | revisions
PluginAssistantEric.zip file | annotate | diff | comparison | revisions
PluginEricAssistant.e4p file | annotate | diff | comparison | revisions
--- a/AssistantEric/APIsManager.py	Sat Nov 26 14:43:28 2016 +0100
+++ b/AssistantEric/APIsManager.py	Sat Dec 03 18:08:44 2016 +0100
@@ -23,6 +23,7 @@
 
 import QScintilla.Lexers
 
+import Globals
 import Utilities.ModuleParser
 import Utilities
 import Preferences
@@ -78,17 +79,23 @@
     """
     
     def __init__(self, proxy, language, apiFiles, projectPath="",
-                 refresh=False):
+                 refresh=False, projectType=""):
         """
         Constructor
         
-        @param proxy reference to the object that is proxied (DbAPIs)
-        @param language language of the APIs object (string)
-        @param apiFiles list of API files to process (list of strings)
+        @param proxy reference to the object that is proxied
+        @type DbAPIs
+        @param language language of the APIs object
+        @type str
+        @param apiFiles list of API files to process
+        @type list of str
         @param projectPath path of the project. Only needed, if the APIs
-            are extracted out of the sources of a project. (string)
+            are extracted out of the sources of a project.
+        @type str
         @param refresh flag indicating a refresh of the APIs of one file
-            (boolean)
+        @type bool
+        @param projectType type of the project
+        @type str
         """
         QThread.__init__(self)
         
@@ -105,10 +112,17 @@
         
         self.__proxy = proxy
         self.__language = language
+        self.__projectType = projectType
         self.__apiFiles = apiFiles[:]
         self.__aborted = False
         self.__projectPath = projectPath
         self.__refresh = refresh
+        
+        if self.__projectType:
+            self.__connectionName = "{0}_{1}".format(
+                self.__language, self.__projectType)
+        else:
+            self.__connectionName = self.__language
     
     def __autoCompletionWordSeparators(self, language):
         """
@@ -132,7 +146,7 @@
         
         @param apiFile filename of the raw API file (string)
         """
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         db.transaction()
         try:
             query = QSqlQuery(db)
@@ -249,7 +263,7 @@
         
         @param apiFile file name of the API file (string)
         """
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         db.transaction()
         try:
             query = QSqlQuery(db)
@@ -286,7 +300,7 @@
         if wseps is None:
             return
 
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         db.transaction()
         try:
             query = QSqlQuery(db)
@@ -410,7 +424,7 @@
         
         @param apiFile filename of the raw API file (string)
         """
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         db.transaction()
         try:
             query = QSqlQuery(db)
@@ -446,7 +460,7 @@
         """
         self.processing.emit(WorkerStatusStarted, "")
         
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         if db.isValid() and db.isOpen():
             # step 1: remove API files not wanted any longer
             if not self.__refresh:
@@ -574,22 +588,37 @@
         INSERT INTO mgmt (format) VALUES ({0:d})
         """.format(DB_VERSION)
     
-    def __init__(self, language, parent=None):
+    def __init__(self, language, projectType="", parent=None):
         """
         Constructor
         
-        @param language language of the APIs object (string)
-        @param parent reference to the parent object (QObject)
+        @param language language of the APIs object
+        @type str
+        @param projectType type of the project
+        @type str
+        @param parent reference to the parent object
+        @type QObject
         """
         QObject.__init__(self, parent)
-        self.setObjectName("DbAPIs_{0}".format(language))
+        if projectType:
+            self.setObjectName("DbAPIs_{0}_{1}".format(language, projectType))
+        else:
+            self.setObjectName("DbAPIs_{0}".format(language))
         
         self.__inPreparation = False
         self.__worker = None
         self.__workerQueue = []
         self.__opened = False
         
+        self.__projectType = projectType
         self.__language = language
+        
+        if self.__projectType:
+            self.__connectionName = "{0}_{1}".format(
+                self.__language, self.__projectType)
+        else:
+            self.__connectionName = self.__language
+        
         if self.__language == ApisNameProject:
             self.__initAsProject()
         else:
@@ -620,7 +649,12 @@
         else:
             self.__discardFirst = []
         self.__lexer = QScintilla.Lexers.getLexer(self.__language)
-        self.__apifiles = Preferences.getEditorAPI(self.__language)
+        try:
+            self.__apifiles = Preferences.getEditorAPI(
+                self.__language, projectType=self.__projectType)
+        except TypeError:
+            # older interface
+            self.__apifiles = Preferences.getEditorAPI(self.__language)
         self.__apifiles.sort()
         if self.__lexer is not None:
             self.__openAPIs()
@@ -635,10 +669,15 @@
             return os.path.join(self.__project.getProjectManagementDir(),
                                 "project-apis.db")
         else:
-            apiDir = os.path.join(Utilities.getConfigDir(), "APIs")
-            if not os.path.exists(apiDir):
-                os.makedirs(apiDir)
-            return os.path.join(apiDir, "{0}-api.db".format(self.__language))
+            apisDir = os.path.join(Globals.getConfigDir(), "APIs")
+            if not os.path.exists(apisDir):
+                os.makedirs(apisDir)
+            if self.__projectType:
+                filename = "{0}_{1}-api.db".format(self.__language,
+                                                   self.__projectType)
+            else:
+                filename = "{0}-api.db".format(self.__language)
+            return os.path.join(apisDir, filename)
     
     def close(self):
         """
@@ -655,8 +694,9 @@
                     if self.__worker is not None:
                         self.__worker.wait(5000)
         
-        if QSqlDatabase and QSqlDatabase.database(self.__language).isOpen():
-            QSqlDatabase.database(self.__language).close()
+        if QSqlDatabase and QSqlDatabase.database(
+                self.__connectionName).isOpen():
+            QSqlDatabase.database(self.__connectionName).close()
             QSqlDatabase.removeDatabase(self.__language)
         
         self.__opened = False
@@ -667,10 +707,10 @@
         
         @return flag indicating the database status (boolean)
         """
-        db = QSqlDatabase.database(self.__language, False)
+        db = QSqlDatabase.database(self.__connectionName, False)
         if not db.isValid():
             # the database connection is a new one
-            db = QSqlDatabase.addDatabase("QSQLITE", self.__language)
+            db = QSqlDatabase.addDatabase("QSQLITE", self.__connectionName)
             dbName = self._apiDbName()
             if self.__language == ApisNameProject and \
                     not os.path.exists(
@@ -680,7 +720,7 @@
                 db.setDatabaseName(dbName)
                 opened = db.open()
             if not opened:
-                QSqlDatabase.removeDatabase(self.__language)
+                QSqlDatabase.removeDatabase(self.__connectionName)
         else:
             opened = True
         return opened
@@ -689,7 +729,7 @@
         """
         Private method to create an API database.
         """
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         db.transaction()
         try:
             query = QSqlQuery(db)
@@ -728,7 +768,7 @@
         """
         apiFiles = []
         
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         db.transaction()
         try:
             query = QSqlQuery(db)
@@ -747,7 +787,7 @@
         
         @return flag indicating the prepared status (boolean)
         """
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         prepared = len(db.tables()) > 0
         if prepared:
             db.transaction()
@@ -782,7 +822,7 @@
         """
         completions = []
         
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         if db.isOpen() and not self.__inPreparation:
             db.transaction()
             try:
@@ -845,7 +885,7 @@
         """
         calltips = []
         
-        db = QSqlDatabase.database(self.__language)
+        db = QSqlDatabase.database(self.__connectionName)
         if db.isOpen() and not self.__inPreparation:
             if self.autoCompletionWordSeparators():
                 contextSeparator = self.autoCompletionWordSeparators()[0]
@@ -985,10 +1025,17 @@
                 [f for f in self.__getProjectFormSources() if
                  f not in apiFiles])
             projectPath = self.__project.getProjectPath()
+            projectType = ""
         else:
-            apiFiles = Preferences.getEditorAPI(self.__language)
+            try:
+                apiFiles = Preferences.getEditorAPI(
+                    self.__language, projectType=self.__projectType)
+            except TypeError:
+                # older interface
+                apiFiles = Preferences.getEditorAPI(self.__language)
+            projectType = self.__projectType
         self.__worker = DbAPIsWorker(self, self.__language, apiFiles,
-                                     projectPath)
+                                     projectPath, projectType=projectType)
         self.__worker.processing.connect(
             self.__processingStatus, Qt.QueuedConnection)
         self.__worker.start()
@@ -1006,10 +1053,13 @@
             if self.__language == ApisNameProject:
                 projectPath = self.__project.getProjectPath()
                 apiFiles = [apiFiles[0].replace(projectPath + os.sep, "")]
+                projectType = ""
             else:
                 projectPath = ""
+                projectType = self.__projectType
             self.__worker = DbAPIsWorker(self, self.__language, apiFiles,
-                                         projectPath, refresh=True)
+                                         projectPath, projectType=projectType,
+                                         refresh=True)
             self.__worker.processing.connect(
                 self.__processingStatus, Qt.QueuedConnection)
             self.__worker.start()
@@ -1122,7 +1172,7 @@
         @param parent reference to the parent object (QObject)
         """
         QObject.__init__(self, parent)
-        self.setObjectName("APIsManager")
+        self.setObjectName("Assistant_APIsManager")
         
         self.__mw = mainWindow
         
@@ -1136,7 +1186,7 @@
         for api in list(self.__apis.values()):
             api and api.prepareAPIs()
     
-    def getAPIs(self, language):
+    def getAPIs(self, language, projectType=""):
         """
         Public method to get an apis object for autocompletion/calltips.
         
@@ -1144,22 +1194,43 @@
         This saves memory for languages, that might not be needed at the
         moment.
         
-        @param language the language of the requested api object (string)
-        @return the apis object (APIs)
+        @param language language of the requested APIs object
+        @type str
+        @param projectType type of the project
+        @type str
+        @return reference to the APIs object
+        @rtype APIs
         """
         try:
-            return self.__apis[language]
+            return self.__apis[(language, projectType)]
         except KeyError:
-            if language in QScintilla.Lexers.getSupportedLanguages() or \
+            if language in self.__supportedApiLanguages() or \
                language == ApisNameProject:
                 # create the api object
-                api = DbAPIs(language)
+                api = DbAPIs(language, projectType=projectType)
                 api.apiPreparationStatus.connect(self.__apiPreparationStatus)
-                self.__apis[language] = api
-                return self.__apis[language]
+                self.__apis[(language, projectType)] = api
+                return self.__apis[(language, projectType)]
             else:
                 return None
     
+    def __supportedApiLanguages(self):
+        """
+        Private method to build a list of supported API languages.
+        
+        Note: This is a compatibility method to make this code work with
+        older eric versions.
+        
+        @return list of supported API languages
+        @rtype list of str
+        """
+        try:
+            return QScintilla.Lexers.getSupportedApiLanguages()
+        except AttributeError:
+            return [lang for lang in
+                    QScintilla.Lexers.getSupportedLanguages().keys()
+                    if lang != "Guessed" and not lang.startswith("Pygments|")]
+    
     def deactivate(self):
         """
         Public method to perform actions upon deactivation.
--- a/AssistantEric/Assistant.py	Sat Nov 26 14:43:28 2016 +0100
+++ b/AssistantEric/Assistant.py	Sat Dec 03 18:08:44 2016 +0100
@@ -123,9 +123,14 @@
         self.__editors.append(editor)
         
         # preload the api to give the manager a chance to prepare the database
-        language = editor.getLanguage()
+        try:
+            language = editor.getApiLanguage()
+        except AttributeError:
+            # backward compatibility
+            language = editor.apiLanguage
         if language:
-            self.__apisManager.getAPIs(language)
+            projectType = self.__getProjectType(editor)
+            self.__apisManager.getAPIs(language, projectType=projectType)
     
     def __editorClosed(self, editor):
         """
@@ -158,6 +163,24 @@
         """
         self.__apisManager.reloadAPIs()
     
+    def __getProjectType(self, editor):
+        """
+        Private method to determine the project type to be used.
+        
+        @param editor reference to the editor to check
+        @type Editor
+        @return project type
+        @rtype str
+        """
+        filename = editor.getFileName()
+        if self.__project.isOpen() and filename and \
+                self.__project.isProjectFile(filename):
+            projectType = self.__project.getProjectType()
+        else:
+            projectType = ""
+        
+        return projectType
+    
     #################################
     ## auto-completion methods below
     #################################
@@ -269,9 +292,21 @@
         @param context flag indicating to autocomplete a context (boolean)
         @return list of possible completions (list of strings)
         """
-        language = editor.getLanguage()
-        if language == "":
-            return []
+        try:
+            language = editor.getApiLanguage()
+        except AttributeError:
+            # backward compatibility
+            language = editor.apiLanguage
+        
+        completeFromDocumentOnly = False
+        if language in ["", "Guessed"] or language.startswith("Pygments|"):
+            if self.__plugin.getPreferences("AutoCompletionSource") & \
+                    AcsDocument:
+                completeFromDocumentOnly = True
+            else:
+                return []
+        
+        projectType = self.__getProjectType(editor)
         
         line, col = editor.getCursorPosition()
         self.__completingContext = context
@@ -374,19 +409,19 @@
         
         if word or importCompletion:
             completionsList = self.__getCompletions(
-                word, context, prefix, language, mod, editor,
-                importCompletion, sep)
+                word, context, prefix, language, projectType, mod, editor,
+                importCompletion, completeFromDocumentOnly, sep)
             if len(completionsList) == 0 and prefix:
                 # searching with prefix didn't return anything, try without
                 completionsList = self.__getCompletions(
-                    word, context, "", language, mod, editor, importCompletion,
-                    sep)
+                    word, context, "", language, projectType, mod, editor,
+                    importCompletion, completeFromDocumentOnly, sep)
             return completionsList
         
         return []
-
-    def __getCompletions(self, word, context, prefix, language, module, editor,
-                         importCompletion, sep):
+    
+    def __getCompletions(self, word, context, prefix, language, projectType,
+                         module, editor, importCompletion, documentOnly, sep):
         """
         Private method to get the list of possible completions.
         
@@ -394,9 +429,12 @@
         @param context flag indicating to autocomplete a context (boolean)
         @param prefix prefix of the word to be completed (string)
         @param language programming language of the source (string)
+        @param projectType type of the project (string)
         @param module reference to the scanned module info (Module)
         @param editor reference to the editor object (QScintilla.Editor.Editor)
         @param importCompletion flag indicating an import completion (boolean)
+        @param documentOnly flag indicating to complete from the document only
+            (boolean)
         @param sep separator string (string)
         @return list of possible completions (list of strings)
         """
@@ -404,15 +442,18 @@
         docCompletionsList = []
         projectCompletionList = []
         
-        if self.__plugin.getPreferences("AutoCompletionSource") & AcsAPIs:
-            api = self.__apisManager.getAPIs(language)
-            apiCompletionsList = self.__getApiCompletions(
-                api, word, context, prefix, module, editor)
-        
-        if self.__plugin.getPreferences("AutoCompletionSource") & AcsProject:
-            api = self.__apisManager.getAPIs(ApisNameProject)
-            projectCompletionList = self.__getApiCompletions(
-                api, word, context, prefix, module, editor)
+        if not documentOnly:
+            if self.__plugin.getPreferences("AutoCompletionSource") & AcsAPIs:
+                api = self.__apisManager.getAPIs(
+                    language, projectType=projectType)
+                apiCompletionsList = self.__getApiCompletions(
+                    api, word, context, prefix, module, editor)
+            
+            if self.__plugin.getPreferences("AutoCompletionSource") & \
+                    AcsProject:
+                api = self.__apisManager.getAPIs(ApisNameProject)
+                projectCompletionList = self.__getApiCompletions(
+                    api, word, context, prefix, module, editor)
         
         if self.__plugin.getPreferences("AutoCompletionSource") & AcsDocument \
                 and not importCompletion:
@@ -738,9 +779,21 @@
             (integer)
         @return list of possible calltips (list of strings)
         """
-        language = editor.getLanguage()
-        if language == "":
-            return
+        try:
+            language = editor.getApiLanguage()
+        except AttributeError:
+            # backward compatibility
+            language = editor.apiLanguage
+        
+        completeFromDocumentOnly = False
+        if language in ["", "Guessed"] or language.startswith("Pygments|"):
+            if self.__plugin.getPreferences("AutoCompletionSource") & \
+                    AcsDocument:
+                completeFromDocumentOnly = True
+            else:
+                return []
+        
+        projectType = self.__getProjectType(editor)
         
         line, col = editor.lineIndexFromPosition(pos)
         wc = re.sub("\w", "", editor.wordCharacters())
@@ -778,17 +831,20 @@
         projectCalltips = []
         documentCalltips = []
         
-        if self.__plugin.getPreferences("AutoCompletionSource") & AcsAPIs:
-            api = self.__apisManager.getAPIs(language)
-            if api is not None:
-                apiCalltips = self.__getApiCalltips(
+        if not completeFromDocumentOnly:
+            if self.__plugin.getPreferences("AutoCompletionSource") & AcsAPIs:
+                api = self.__apisManager.getAPIs(
+                    language, projectType=projectType)
+                if api is not None:
+                    apiCalltips = self.__getApiCalltips(
+                        api, word, commas, prefix, mod, editor)
+            
+            if self.__plugin.getPreferences("AutoCompletionSource") & \
+                    AcsProject:
+                api = self.__apisManager.getAPIs(ApisNameProject)
+                projectCalltips = self.__getApiCalltips(
                     api, word, commas, prefix, mod, editor)
         
-        if self.__plugin.getPreferences("AutoCompletionSource") & AcsProject:
-            api = self.__apisManager.getAPIs(ApisNameProject)
-            projectCalltips = self.__getApiCalltips(
-                api, word, commas, prefix, mod, editor)
-        
         if self.__plugin.getPreferences("AutoCompletionSource") & AcsDocument:
             documentCalltips = self.__getDocumentCalltips(
                 word, prefix, mod, editor)
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.APIsManager.html	Sat Nov 26 14:43:28 2016 +0100
+++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.APIsManager.html	Sat Dec 03 18:08:44 2016 +0100
@@ -82,6 +82,9 @@
 <td><a href="#APIsManager.__showMessage">__showMessage</a></td>
 <td>Private message to show a message in the main windows status bar.</td>
 </tr><tr>
+<td><a href="#APIsManager.__supportedApiLanguages">__supportedApiLanguages</a></td>
+<td>Private method to build a list of supported API languages.</td>
+</tr><tr>
 <td><a href="#APIsManager.deactivate">deactivate</a></td>
 <td>Public method to perform actions upon deactivation.</td>
 </tr><tr>
@@ -166,6 +169,24 @@
 <dd>
 message to be shown (string)
 </dd>
+</dl><a NAME="APIsManager.__supportedApiLanguages" ID="APIsManager.__supportedApiLanguages"></a>
+<h4>APIsManager.__supportedApiLanguages</h4>
+<b>__supportedApiLanguages</b>(<i></i>)
+<p>
+        Private method to build a list of supported API languages.
+</p><p>
+        Note: This is a compatibility method to make this code work with
+        older eric versions.
+</p><dl>
+<dt>Returns:</dt>
+<dd>
+list of supported API languages
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+list of str
+</dd>
 </dl><a NAME="APIsManager.deactivate" ID="APIsManager.deactivate"></a>
 <h4>APIsManager.deactivate</h4>
 <b>deactivate</b>(<i></i>)
@@ -173,7 +194,7 @@
         Public method to perform actions upon deactivation.
 </p><a NAME="APIsManager.getAPIs" ID="APIsManager.getAPIs"></a>
 <h4>APIsManager.getAPIs</h4>
-<b>getAPIs</b>(<i>language</i>)
+<b>getAPIs</b>(<i>language, projectType=""</i>)
 <p>
         Public method to get an apis object for autocompletion/calltips.
 </p><p>
@@ -181,14 +202,22 @@
         This saves memory for languages, that might not be needed at the
         moment.
 </p><dl>
-<dt><i>language</i></dt>
+<dt><i>language</i> (str)</dt>
 <dd>
-the language of the requested api object (string)
+language of the requested APIs object
+</dd><dt><i>projectType</i> (str)</dt>
+<dd>
+type of the project
 </dd>
 </dl><dl>
 <dt>Returns:</dt>
 <dd>
-the apis object (APIs)
+reference to the APIs object
+</dd>
+</dl><dl>
+<dt>Return Type:</dt>
+<dd>
+APIs
 </dd>
 </dl><a NAME="APIsManager.reloadAPIs" ID="APIsManager.reloadAPIs"></a>
 <h4>APIsManager.reloadAPIs</h4>
@@ -302,16 +331,19 @@
 </table>
 <a NAME="DbAPIs.__init__" ID="DbAPIs.__init__"></a>
 <h4>DbAPIs (Constructor)</h4>
-<b>DbAPIs</b>(<i>language, parent=None</i>)
+<b>DbAPIs</b>(<i>language, projectType="", parent=None</i>)
 <p>
         Constructor
 </p><dl>
-<dt><i>language</i></dt>
+<dt><i>language</i> (str)</dt>
+<dd>
+language of the APIs object
+</dd><dt><i>projectType</i> (str)</dt>
 <dd>
-language of the APIs object (string)
-</dd><dt><i>parent</i></dt>
+type of the project
+</dd><dt><i>parent</i> (QObject)</dt>
 <dd>
-reference to the parent object (QObject)
+reference to the parent object
 </dd>
 </dl><a NAME="DbAPIs.__createApiDB" ID="DbAPIs.__createApiDB"></a>
 <h4>DbAPIs.__createApiDB</h4>
@@ -622,27 +654,29 @@
 </table>
 <a NAME="DbAPIsWorker.__init__" ID="DbAPIsWorker.__init__"></a>
 <h4>DbAPIsWorker (Constructor)</h4>
-<b>DbAPIsWorker</b>(<i>proxy, language, apiFiles, projectPath="", refresh=False</i>)
+<b>DbAPIsWorker</b>(<i>proxy, language, apiFiles, projectPath="", refresh=False, projectType=""</i>)
 <p>
         Constructor
 </p><dl>
-<dt><i>proxy</i></dt>
+<dt><i>proxy</i> (DbAPIs)</dt>
 <dd>
-reference to the object that is proxied (DbAPIs)
-</dd><dt><i>language</i></dt>
+reference to the object that is proxied
+</dd><dt><i>language</i> (str)</dt>
 <dd>
-language of the APIs object (string)
-</dd><dt><i>apiFiles</i></dt>
+language of the APIs object
+</dd><dt><i>apiFiles</i> (list of str)</dt>
 <dd>
-list of API files to process (list of strings)
-</dd><dt><i>projectPath</i></dt>
+list of API files to process
+</dd><dt><i>projectPath</i> (str)</dt>
 <dd>
 path of the project. Only needed, if the APIs
-            are extracted out of the sources of a project. (string)
-</dd><dt><i>refresh</i></dt>
+            are extracted out of the sources of a project.
+</dd><dt><i>refresh</i> (bool)</dt>
 <dd>
 flag indicating a refresh of the APIs of one file
-            (boolean)
+</dd><dt><i>projectType</i> (str)</dt>
+<dd>
+type of the project
 </dd>
 </dl><a NAME="DbAPIsWorker.__autoCompletionWordSeparators" ID="DbAPIsWorker.__autoCompletionWordSeparators"></a>
 <h4>DbAPIsWorker.__autoCompletionWordSeparators</h4>
--- a/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html	Sat Nov 26 14:43:28 2016 +0100
+++ b/AssistantEric/Documentation/source/Plugin_Assistant_Eric.AssistantEric.Assistant.html	Sat Dec 03 18:08:44 2016 +0100
@@ -85,6 +85,9 @@
 <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>
@@ -238,7 +241,7 @@
 </dd>
 </dl><a NAME="Assistant.__getCompletions" ID="Assistant.__getCompletions"></a>
 <h4>Assistant.__getCompletions</h4>
-<b>__getCompletions</b>(<i>word, context, prefix, language, module, editor, importCompletion, sep</i>)
+<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>
@@ -254,6 +257,9 @@
 </dd><dt><i>language</i></dt>
 <dd>
 programming language of the source (string)
+</dd><dt><i>projectType</i></dt>
+<dd>
+type of the project (string)
 </dd><dt><i>module</i></dt>
 <dd>
 reference to the scanned module info (Module)
@@ -263,6 +269,10 @@
 </dd><dt><i>importCompletion</i></dt>
 <dd>
 flag indicating an import completion (boolean)
+</dd><dt><i>documentOnly</i></dt>
+<dd>
+flag indicating to complete from the document only
+            (boolean)
 </dd><dt><i>sep</i></dt>
 <dd>
 separator string (string)
@@ -332,6 +342,26 @@
 <dd>
 list of possible completions (list of strings)
 </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>Returns:</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>)
--- a/ChangeLog	Sat Nov 26 14:43:28 2016 +0100
+++ b/ChangeLog	Sat Dec 03 18:08:44 2016 +0100
@@ -1,5 +1,11 @@
 ChangeLog
 ---------
+Version 3.2.0:
+- bug fixes
+- added support for project type specific API configurations
+  (used by auto-completion and calltips)
+  Note: This needs an eric release > 16.12
+
 Version 3.1.3:
 - bug fixes
 
--- a/PluginAssistantEric.py	Sat Nov 26 14:43:28 2016 +0100
+++ b/PluginAssistantEric.py	Sat Dec 03 18:08:44 2016 +0100
@@ -24,7 +24,7 @@
 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
 autoactivate = True
 deactivateable = True
-version = "3.1.3"
+version = "3.2.0"
 className = "AssistantEricPlugin"
 packageName = "AssistantEric"
 shortDescription = "Alternative autocompletion and calltips provider."
@@ -158,11 +158,11 @@
             return False
         
         drivers = QSqlDatabase.drivers()
-        if "QSQLITE" in drivers:
-            return True
-        else:
+        if "QSQLITE" not in drivers:
             error = self.tr("The SQLite database driver is not available.")
             return False
+        
+        return True
     
     def activate(self):
         """
@@ -247,3 +247,6 @@
         
         if key in ["AutoCompletionEnabled", "CalltipsEnabled"]:
             self.__object.setEnabled(key, value)
+
+#
+# eflag: noqa = M801
Binary file PluginAssistantEric.zip has changed
--- a/PluginEricAssistant.e4p	Sat Nov 26 14:43:28 2016 +0100
+++ b/PluginEricAssistant.e4p	Sat Dec 03 18:08:44 2016 +0100
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE Project SYSTEM "Project-5.1.dtd">
 <!-- eric project file for project PluginEricAssistant -->
-<!-- Copyright (C) 2015 Detlev Offenbach, detlev@die-offenbachs.de -->
+<!-- Copyright (C) 2016 Detlev Offenbach, detlev@die-offenbachs.de -->
 <Project version="5.1">
   <Language>en</Language>
   <Hash>3ad6504a180bc4770ebb6d0123dfcca5c4b21f8c</Hash>
@@ -14,50 +14,50 @@
   <TranslationPattern>AssistantEric/i18n/assistant_%language%.ts</TranslationPattern>
   <Eol index="1"/>
   <Sources>
-    <Source>PluginAssistantEric.py</Source>
-    <Source>AssistantEric/__init__.py</Source>
+    <Source>AssistantEric/APIsManager.py</Source>
     <Source>AssistantEric/Assistant.py</Source>
-    <Source>AssistantEric/APIsManager.py</Source>
-    <Source>__init__.py</Source>
     <Source>AssistantEric/ConfigurationPages/AutoCompletionEricPage.py</Source>
     <Source>AssistantEric/ConfigurationPages/CallTipsEricPage.py</Source>
     <Source>AssistantEric/ConfigurationPages/__init__.py</Source>
+    <Source>AssistantEric/__init__.py</Source>
+    <Source>PluginAssistantEric.py</Source>
+    <Source>__init__.py</Source>
   </Sources>
   <Forms>
     <Form>AssistantEric/ConfigurationPages/AutoCompletionEricPage.ui</Form>
     <Form>AssistantEric/ConfigurationPages/CallTipsEricPage.ui</Form>
   </Forms>
   <Translations>
-    <Translation>AssistantEric/i18n/assistant_de.ts</Translation>
+    <Translation>AssistantEric/i18n/assistant_cs.qm</Translation>
     <Translation>AssistantEric/i18n/assistant_cs.ts</Translation>
-    <Translation>AssistantEric/i18n/assistant_fr.ts</Translation>
-    <Translation>AssistantEric/i18n/assistant_ru.ts</Translation>
+    <Translation>AssistantEric/i18n/assistant_de.qm</Translation>
+    <Translation>AssistantEric/i18n/assistant_de.ts</Translation>
+    <Translation>AssistantEric/i18n/assistant_en.qm</Translation>
+    <Translation>AssistantEric/i18n/assistant_en.ts</Translation>
+    <Translation>AssistantEric/i18n/assistant_es.qm</Translation>
     <Translation>AssistantEric/i18n/assistant_es.ts</Translation>
-    <Translation>AssistantEric/i18n/assistant_zh_CN.GB2312.ts</Translation>
-    <Translation>AssistantEric/i18n/assistant_de.qm</Translation>
-    <Translation>AssistantEric/i18n/assistant_cs.qm</Translation>
     <Translation>AssistantEric/i18n/assistant_fr.qm</Translation>
-    <Translation>AssistantEric/i18n/assistant_ru.qm</Translation>
-    <Translation>AssistantEric/i18n/assistant_es.qm</Translation>
-    <Translation>AssistantEric/i18n/assistant_zh_CN.GB2312.qm</Translation>
-    <Translation>AssistantEric/i18n/assistant_it.ts</Translation>
+    <Translation>AssistantEric/i18n/assistant_fr.ts</Translation>
     <Translation>AssistantEric/i18n/assistant_it.qm</Translation>
-    <Translation>AssistantEric/i18n/assistant_en.ts</Translation>
-    <Translation>AssistantEric/i18n/assistant_en.qm</Translation>
+    <Translation>AssistantEric/i18n/assistant_it.ts</Translation>
+    <Translation>AssistantEric/i18n/assistant_pt.qm</Translation>
     <Translation>AssistantEric/i18n/assistant_pt.ts</Translation>
-    <Translation>AssistantEric/i18n/assistant_pt.qm</Translation>
+    <Translation>AssistantEric/i18n/assistant_ru.qm</Translation>
+    <Translation>AssistantEric/i18n/assistant_ru.ts</Translation>
+    <Translation>AssistantEric/i18n/assistant_zh_CN.GB2312.qm</Translation>
+    <Translation>AssistantEric/i18n/assistant_zh_CN.GB2312.ts</Translation>
   </Translations>
   <Resources/>
   <Interfaces/>
   <Others>
+    <Other>.hgignore</Other>
     <Other>AssistantEric/ConfigurationPages/eric.png</Other>
+    <Other>AssistantEric/Documentation/LICENSE.GPL3</Other>
     <Other>AssistantEric/Documentation/source</Other>
     <Other>ChangeLog</Other>
+    <Other>PKGLIST</Other>
+    <Other>PluginAssistantEric.zip</Other>
     <Other>PluginEricAssistant.e4p</Other>
-    <Other>PKGLIST</Other>
-    <Other>AssistantEric/Documentation/LICENSE.GPL3</Other>
-    <Other>PluginAssistantEric.zip</Other>
-    <Other>.hgignore</Other>
   </Others>
   <MainScript>PluginAssistantEric.py</MainScript>
   <Vcs>
@@ -162,9 +162,6 @@
         </value>
       </dict>
     </VcsOptions>
-    <VcsOtherData>
-      <dict/>
-    </VcsOtherData>
   </Vcs>
   <FiletypeAssociations>
     <FiletypeAssociation pattern="*.idl" type="INTERFACES"/>
@@ -228,14 +225,6 @@
               <bool>False</bool>
             </value>
             <key>
-              <string>sourceExtensions</string>
-            </key>
-            <value>
-              <list>
-                <string></string>
-              </list>
-            </value>
-            <key>
               <string>useRecursion</string>
             </key>
             <value>
@@ -255,6 +244,18 @@
         <value>
           <dict>
             <key>
+              <string>CopyrightAuthor</string>
+            </key>
+            <value>
+              <string></string>
+            </value>
+            <key>
+              <string>CopyrightMinFileSize</string>
+            </key>
+            <value>
+              <int>0</int>
+            </value>
+            <key>
               <string>DocstringType</string>
             </key>
             <value>
@@ -270,7 +271,7 @@
               <string>ExcludeMessages</string>
             </key>
             <value>
-              <string>W293, N802, N803, N807, N808, N821,E265</string>
+              <string>C101, E265, N802, N803, N807, N808, N821, W293, E266</string>
             </value>
             <key>
               <string>FixCodes</string>
@@ -285,6 +286,12 @@
               <bool>False</bool>
             </value>
             <key>
+              <string>FutureChecker</string>
+            </key>
+            <value>
+              <string></string>
+            </value>
+            <key>
               <string>HangClosing</string>
             </key>
             <value>
@@ -297,6 +304,12 @@
               <string></string>
             </value>
             <key>
+              <string>MaxCodeComplexity</string>
+            </key>
+            <value>
+              <int>10</int>
+            </value>
+            <key>
               <string>MaxLineLength</string>
             </key>
             <value>
@@ -320,6 +333,12 @@
             <value>
               <bool>False</bool>
             </value>
+            <key>
+              <string>ValidEncodings</string>
+            </key>
+            <value>
+              <string>latin-1, utf-8</string>
+            </value>
           </dict>
         </value>
       </dict>

eric ide

mercurial