--- a/AssistantEric/APIsManager.py Sun Feb 24 15:03:27 2013 +0100 +++ b/AssistantEric/APIsManager.py Tue Apr 02 19:32:26 2013 +0200 @@ -419,14 +419,14 @@ """ Class implementing an API storage entity. - @signal apiPreparationFinished() emitted after the API preparation has finished - @signal apiPreparationStarted() emitted after the API preparation has started - @signal apiPreparationCancelled() emitted after the API preparation has been + @signal apiPreparationFinished(language) emitted after the API preparation has finished + @signal apiPreparationStarted(language) emitted after the API preparation has started + @signal apiPreparationCancelled(language) emitted after the API preparation has been cancelled """ - apiPreparationFinished = pyqtSignal() - apiPreparationStarted = pyqtSignal() - apiPreparationCancelled = pyqtSignal() + apiPreparationFinished = pyqtSignal(str) + apiPreparationStarted = pyqtSignal(str) + apiPreparationCancelled = pyqtSignal(str) DB_VERSION = 4 @@ -957,18 +957,18 @@ """ if evt.type() == WorkerStarted: self.__inPreparation = True - self.apiPreparationStarted.emit() + self.apiPreparationStarted.emit(self.__language) return True elif evt.type() == WorkerFinished: self.__inPreparation = False - self.apiPreparationFinished.emit() + self.apiPreparationFinished.emit(self.__language) QTimer.singleShot(0, self.__processQueue) return True elif evt.type() == WorkerAborted: self.__inPreparation = False - self.apiPreparationCancelled.emit() + self.apiPreparationCancelled.emit(self.__language) QTimer.singleShot(0, self.__processQueue) return True @@ -1021,15 +1021,18 @@ Class implementing the APIsManager class, which is the central store for API information used by autocompletion and calltips. """ - def __init__(self, parent=None): + def __init__(self, mainWindow, parent=None): """ Constructor + @param mainWindow reference to the main eric5 window (QMainWindow) @param parent reference to the parent object (QObject) """ QObject.__init__(self, parent) self.setObjectName("APIsManager") + self.__mw = mainWindow + # initialize the apis dictionary self.__apis = {} @@ -1056,7 +1059,11 @@ if language in QScintilla.Lexers.getSupportedLanguages() or \ language == ApisNameProject: # create the api object - self.__apis[language] = DbAPIs(language) + api = DbAPIs(language) + api.apiPreparationFinished.connect(self.__apiPreparationFinished) + api.apiPreparationStarted.connect(self.__apiPreparationStarted) + api.apiPreparationCancelled.connect(self.__apiPreparationCancelled) + self.__apis[language] = api return self.__apis[language] else: return None @@ -1067,4 +1074,46 @@ """ for apiLang in self.__apis: self.__apis[apiLang].close() + self.__apis[apiLang].deleteLater() self.__apis[apiLang] = None + + def __showMessage(self, msg): + """ + Private message to show a message in the main windows status bar. + + @param msg message to be shown (string) + """ + self.__mw.statusBar().showMessage(msg, 2000) + + def __apiPreparationFinished(self, language): + """ + Private slot handling the preparation finished signal of an API object. + + @param language language of the API (string) + """ + if language == ApisNameProject: + language = self.trUtf8("Project") + self.__showMessage(self.trUtf8("Preparation of '{0}' APIs finished.") + .format(language)) + + def __apiPreparationStarted(self, language): + """ + Private slot handling the preparation started signal of an API object. + + @param language language of the API (string) + """ + if language == ApisNameProject: + language = self.trUtf8("Project") + self.__showMessage(self.trUtf8("Preparation of '{0}' APIs started.") + .format(language)) + + def __apiPreparationCancelled(self, language): + """ + Private slot handling the preparation cancelled signal of an API object. + + @param language language of the API (string) + """ + if language == ApisNameProject: + language = self.trUtf8("Project") + self.__showMessage(self.trUtf8("Preparation of '{0}' APIs cancelled.") + .format(language))