def slotOptimiseDatabase(self): self.loadDatabaseBuilder() dbBuild = self.renderThread.getObjectInstance(build.DatabaseBuilder) if dbBuild.isOptimizable(): if KMessageBox.warningContinueCancel(self, i18n("This operation might take some time."), i18n("Optimise Database"), KStandardGuiItem.cont(), KStandardGuiItem.cancel(), 'database_optimise') \ == KMessageBox.Continue: QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) self.currentJob = self.renderThread.enqueue( build.DatabaseBuilder, 'optimize')
def installDictionary(self): if self.currentDictionary in self.dictionaryHasNewer \ and not self.dictionaryHasNewer[self.currentDictionary] \ and KMessageBox.warningContinueCancel(self, i18n("Local version is already up-to-date.\n\nInstall anyway?"), i18n("Reinstall"), KStandardGuiItem.cont(), KStandardGuiItem.cancel(), 'reinstall_confirmation') \ == KMessageBox.Cancel: return downloader = self.getDownloader(self.currentDictionary) link = downloader.getDownloadLink() if not link: self.statusLabel.setText(i18n('Error getting download page "%1"', downloader.lastError)) return self.statusLabel.setText(i18n('Downloading from %1...', link)) self.checkVersionButton.setEnabled(False) self.dictionaryCombo.setEnabled(False) self.removeButton.setEnabled(False) self.installButton.setEnabled(False) self.setWorking(True) filePath, fileType = downloader.download() if filePath: self.statusLabel.setText(i18n('Installing...', link)) dbBuild = self.renderThread.getObjectInstance(build.DatabaseBuilder) builderClass = dbBuild.getTableBuilder(self.currentDictionary) dbBuild.setBuilderOptions(builderClass, {'filePath': unicode(filePath), 'fileType': unicode(fileType)}) tables = [self.currentDictionary] # look for related tables and install them, too relatedKey = self.currentDictionary + '_related' if relatedKey in EclectusCommandLineBuilder.BUILD_GROUPS: tables.extend( EclectusCommandLineBuilder.BUILD_GROUPS[relatedKey]) # TODO UpdateVersion might be installed later # TODO if for the first time a new language is installed check if # tables in BUILD_GROUPS (zh-cmn, ja) need to be installed self.currentJob = self.renderThread.enqueue(build.DatabaseBuilder, 'build', tables) else: self.statusLabel.setText(i18n('Error downloading from "%1": "%2"', link, downloader.lastError)) self.dictionaryCombo.setEnabled(True) self.setWorking(False)