--- a/AssistantEric/APIsManager.py Sun Aug 01 13:08:23 2010 +0200 +++ b/AssistantEric/APIsManager.py Thu Aug 12 19:06:24 2010 +0200 @@ -331,6 +331,10 @@ @signal apiPreparationCancelled() emitted after the API preparation has been cancelled """ + apiPreparationFinished = pyqtSignal() + apiPreparationStarted = pyqtSignal() + apiPreparationCancelled = pyqtSignal() + DB_VERSION = 3 create_mgmt_stmt = """ @@ -408,16 +412,18 @@ INSERT INTO mgmt (format) VALUES ({0:d}) """.format(DB_VERSION) - def __init__(self, language, parent = None): + def __init__(self, language, newStyle, parent = None): """ Constructor @param language language of the APIs object (string) + @param newStyle flag indicating usage of new style signals (bool) @param parent reference to the parent object (QObject) """ QObject.__init__(self, parent) self.setObjectName("DbAPIs_{0}".format(language)) + self.__newStyle = newStyle self.__inPreparation = False self.__worker = None self.__workerQueue = [] @@ -435,9 +441,14 @@ self.__lexer = None self.__project = e5App().getObject("Project") - self.connect(self.__project, SIGNAL("projectOpened"), self.__projectOpened) - self.connect(self.__project, SIGNAL("newProject"), self.__projectOpened) - self.connect(self.__project, SIGNAL("projectClosed"), self.__projectClosed) + if self.__newStyle: + self.__project.projectOpened.connect(self.__projectOpened) + self.__project.newProject.connect(self.__projectOpened) + self.__project.projectClosed.connect(self.__projectClosed) + else: + self.connect(self.__project, SIGNAL("projectOpened"), self.__projectOpened) + self.connect(self.__project, SIGNAL("newProject"), self.__projectOpened) + self.connect(self.__project, SIGNAL("projectClosed"), self.__projectClosed) if self.__project.isOpen(): self.__projectOpened() @@ -766,18 +777,27 @@ """ if evt.type() == WorkerStarted: self.__inPreparation = True - self.emit(SIGNAL('apiPreparationStarted()')) + if self.__newStyle: + self.apiPreparationStarted.emit() + else: + self.emit(SIGNAL('apiPreparationStarted()')) return True elif evt.type() == WorkerFinished: self.__inPreparation = False - self.emit(SIGNAL('apiPreparationFinished()')) + if self.__newStyle: + self.apiPreparationFinished.emit() + else: + self.emit(SIGNAL('apiPreparationFinished()')) QTimer.singleShot(0, self.__processQueue) return True elif evt.type() == WorkerAborted: self.__inPreparation = False - self.emit(SIGNAL('apiPreparationCancelled()')) + if self.__newStyle: + self.apiPreparationCancelled.emit() + else: + self.emit(SIGNAL('apiPreparationCancelled()')) QTimer.singleShot(0, self.__processQueue) return True @@ -820,15 +840,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, newStyle, parent = None): """ Constructor + @param newStyle flag indicating usage of new style signals (bool) @param parent reference to the parent object (QObject) """ QObject.__init__(self, parent) self.setObjectName("APIsManager") + self.__newStyle = newStyle + # initialize the apis dictionary self.__apis = {} @@ -855,7 +878,7 @@ if language in QScintilla.Lexers.getSupportedLanguages() or \ language == ApisNameProject: # create the api object - self.__apis[language] = DbAPIs(language) + self.__apis[language] = DbAPIs(language, self.__newStyle) return self.__apis[language] else: return None