AssistantEric/APIsManager.py

changeset 22
a47afbacaeb5
parent 21
0e54b870314c
child 25
6a68405feb84
--- a/AssistantEric/APIsManager.py	Wed Dec 22 10:31:26 2010 +0100
+++ b/AssistantEric/APIsManager.py	Wed Dec 22 13:37:53 2010 +0100
@@ -55,7 +55,7 @@
         DELETE FROM file WHERE id = :id
     """
     
-    def __init__(self, proxy, language, apiFiles, projectPath = ""):
+    def __init__(self, proxy, language, apiFiles, projectPath = "", refresh = False):
         """
         Constructor
         
@@ -64,6 +64,7 @@
         @param apiFiles list of API files to process (list of strings)
         @param projectPath path of the project. Only needed, if the APIs
             are extracted out of the sources of a project. (string)
+        @param refresh flag indicating a refresh of the APIs of one file (boolean)
         """
         QThread.__init__(self)
         
@@ -83,6 +84,7 @@
         self.__apiFiles = apiFiles[:]
         self.__aborted = False
         self.__projectPath = projectPath
+        self.__refresh = refresh
     
     def __autoCompletionWordSeparators(self, language):
         """
@@ -307,10 +309,11 @@
         db = QSqlDatabase.database(self.__language)
         if db.isValid() and db.isOpen():
             # step 1: remove API files not wanted any longer
-            loadedApiFiles = self.__proxy.getApiFiles()
-            for apiFile in loadedApiFiles:
-                if not self.__aborted and apiFile not in self.__apiFiles:
-                    self.__deleteApiFile(apiFile)
+            if not self.__refresh:
+                loadedApiFiles = self.__proxy.getApiFiles()
+                for apiFile in loadedApiFiles:
+                    if not self.__aborted and apiFile not in self.__apiFiles:
+                        self.__deleteApiFile(apiFile)
             
             # step 2: (re-)load api files
             for apiFile in self.__apiFiles:
@@ -747,7 +750,8 @@
                 apiFiles = [apiFiles[0].replace(projectPath + os.sep, "")]
             else:
                 projectPath = ""
-            self.__worker = DbAPIsWorker(self, self.__language, apiFiles, projectPath)
+            self.__worker = DbAPIsWorker(self, self.__language, apiFiles, projectPath, 
+                                         refresh = True)
             self.__worker.start()
     
     def getLexer(self):

eric ide

mercurial