def findPrev(self): """ Public slot to find the next previous of text. """ if not self.havefound or self.ui.findtextCombo.currentText().isEmpty(): self.show(self.viewmanager.textForFind()) return self.__findBackwards = True txt = self.ui.findtextCombo.currentText() # This moves any previous occurrence of this statement to the head # of the list and updates the combobox self.findHistory.removeAll(txt) self.findHistory.prepend(txt) self.ui.findtextCombo.clear() self.ui.findtextCombo.addItems(self.findHistory) self.emit(SIGNAL('searchListChanged')) ok = self.__findNextPrev(txt, True) if ok: if self.replace: self.ui.replaceButton.setEnabled(True) self.ui.replaceSearchButton.setEnabled(True) else: KQMessageBox.information(self, self.windowTitle(), self.trUtf8("'%1' was not found.").arg(txt))
def on_namedReferenceButton_clicked(self): """ Private slot to handle the named reference toolbutton. """ # determine cursor position as length into text length = self.regexpTextEdit.textCursor().position() # only present group names that occur before the current cursor position regex = unicode(self.regexpTextEdit.toPlainText().left(length)) names = self.namedGroups(regex) if not names: KQMessageBox.information(None, self.trUtf8("Named reference"), self.trUtf8("""No named groups have been defined yet.""")) return qs = QStringList() for name in names: qs.append(name) groupName, ok = KQInputDialog.getItem(\ None, self.trUtf8("Named reference"), self.trUtf8("Select group name:"), qs, 0, True) if ok and not groupName.isEmpty(): self.__insertString("(?P=%s)" % groupName)
def __compileIDLDone(self, exitCode, exitStatus): """ Private slot to handle the finished signal of the omniidl process. @param exitCode exit code of the process (integer) @param exitStatus exit status of the process (QProcess.ExitStatus) """ self.compileRunning = False if exitStatus == QProcess.NormalExit and exitCode == 0: path = os.path.dirname(self.idlFile) poaList = glob.glob(os.path.join(path, "*__POA")) npoaList = [f.replace("__POA", "") for f in poaList] fileList = glob.glob(os.path.join(path, "*_idl.py")) for dir in poaList + npoaList: fileList += Utilities.direntries(dir, True, "*.py") for file in fileList: self.project.appendFile(file) if not self.noDialog: KQMessageBox.information( None, self.trUtf8("Interface Compilation"), self.trUtf8("The compilation of the interface file was successful."), ) else: if not self.noDialog: KQMessageBox.information( None, self.trUtf8("Interface Compilation"), self.trUtf8("The compilation of the interface file failed."), ) self.compileProc = None
def __generateTSFileDone(self, exitCode, exitStatus): """ Private slot to handle the finished signal of the pylupdate process. @param exitCode exit code of the process (integer) @param exitStatus exit status of the process (QProcess.ExitStatus) """ if exitStatus == QProcess.NormalExit and exitCode == 0: KQMessageBox.information(None, self.trUtf8("Translation file generation"), self.trUtf8("The generation of the translation files (*.ts)" " was successful.")) else: KQMessageBox.critical(None, self.trUtf8("Translation file generation"), self.trUtf8("The generation of the translation files (*.ts) has failed.")) proc = self.sender() for index in range(len(self.__pylupdateProcesses)): if proc == self.__pylupdateProcesses[index][0]: try: os.remove(self.__pylupdateProcesses[index][1]) except EnvironmentError: pass del self.__pylupdateProcesses[index] break if not self.__pylupdateProcesses: # all done self.pylupdateProcRunning = False
def __init__(self, parent = None): """ Constructor @param parent reference to the parent widget (QWidget) """ QWidget.__init__(self, parent) self.setupUi(self) self.table.addAction(self.insertRowAction) self.table.addAction(self.deleteRowAction) if QSqlDatabase.drivers().isEmpty(): KQMessageBox.information(None, self.trUtf8("No database drivers found"), self.trUtf8("""This tool requires at least one Qt database driver. """ """Please check the Qt documentation how to build the """ """Qt SQL plugins.""")) self.connect(self.connections, SIGNAL("tableActivated(QString)"), self.on_connections_tableActivated) self.connect(self.connections, SIGNAL("schemaRequested(QString)"), self.on_connections_schemaRequested) self.connect(self.connections, SIGNAL("cleared()"), self.on_connections_cleared) self.emit(SIGNAL("statusMessage(QString)"), self.trUtf8("Ready"))
def on_validateButton_clicked(self): """ Private slot to validate the entered regexp. """ regex = self.regexpLineEdit.text() if not regex.isEmpty(): re = QRegExp(regex) if self.caseSensitiveCheckBox.isChecked(): re.setCaseSensitivity(Qt.CaseSensitive) else: re.setCaseSensitivity(Qt.CaseInsensitive) re.setMinimal(self.minimalCheckBox.isChecked()) if self.wildcardCheckBox.isChecked(): re.setPatternSyntax(QRegExp.Wildcard) else: re.setPatternSyntax(QRegExp.RegExp) if re.isValid(): KQMessageBox.information(None, self.trUtf8(""), self.trUtf8("""The regular expression is valid.""")) else: KQMessageBox.critical(None, self.trUtf8("Error"), self.trUtf8("""Invalid regular expression: %1""") .arg(re.errorString())) return else: KQMessageBox.critical(None, self.trUtf8("Error"), self.trUtf8("""A regular expression must be given."""))
def _selectEntries(self, local = True, filter = None): """ Protected method to select entries based on their VCS status. @param local flag indicating local (i.e. non VCS controlled) file/directory entries should be selected (boolean) @param filter list of classes to check against """ if self.project.vcs is None: return if local: compareString = QApplication.translate('ProjectBaseBrowser', "local") else: compareString = QString(self.project.vcs.vcsName()) # expand all directories in order to iterate over all entries self._expandAllDirs() QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) QApplication.processEvents() self.selectionModel().clear() QApplication.processEvents() # now iterate over all entries startIndex = None endIndex = None selectedEntries = 0 index = self.model().index(0, 0) while index.isValid(): itm = self.model().item(index) if self.wantedItem(itm, filter) and \ QString.compare(compareString, itm.data(1)) == 0: if startIndex is not None and \ startIndex.parent() != index.parent(): self._setItemRangeSelected(startIndex, endIndex, True) startIndex = None selectedEntries += 1 if startIndex is None: startIndex = index endIndex = index else: if startIndex is not None: self._setItemRangeSelected(startIndex, endIndex, True) startIndex = None index = self.indexBelow(index) if startIndex is not None: self._setItemRangeSelected(startIndex, endIndex, True) QApplication.restoreOverrideCursor() QApplication.processEvents() if selectedEntries == 0: KQMessageBox.information(None, QApplication.translate('ProjectBaseBrowser', "Select entries"), QApplication.translate('ProjectBaseBrowser', """There were no matching entries found."""))
def on_helpButton_clicked(self): """ Public slot to show some help. """ KQMessageBox.information(self, self.trUtf8("Template Help"), self.trUtf8(\ """<p>To use variables in a template, you just have to enclose""" """ the variablename with $-characters. When you use the template,""" """ you will then be asked for a value for this variable.</p>""" """<p>Example template: This is a $VAR$</p>""" """<p>When you use this template you will be prompted for a value""" """ for the variable $VAR$. Any occurrences of $VAR$ will then be""" """ replaced with whatever you've entered.</p>""" """<p>If you need a single $-character in a template, which is not""" """ used to enclose a variable, type $$(two dollar characters)""" """ instead. They will automatically be replaced with a single""" """ $-character when you use the template.</p>""" """<p>If you want a variables contents to be treated specially,""" """ the variablename must be followed by a ':' and one formatting""" """ specifier (e.g. $VAR:ml$). The supported specifiers are:""" """<table>""" """<tr><td>ml</td><td>Specifies a multiline formatting.""" """ The first line of the variable contents is prefixed with the string""" """ occuring before the variable on the same line of the template.""" """ All other lines are prefixed by the same amount of whitespace""" """ as the line containing the variable.""" """</td></tr>""" """<tr><td>rl</td><td>Specifies a repeated line formatting.""" """ Each line of the variable contents is prefixed with the string""" """ occuring before the variable on the same line of the template.""" """</td></tr>""" """</table></p>""" """<p>The following predefined variables may be used in a template:""" """<table>""" """<tr><td>date</td>""" """<td>today's date in ISO format (YYYY-MM-DD)</td></tr>""" """<tr><td>year</td>""" """<td>the current year</td></tr>""" """<tr><td>project_name</td>""" """<td>the name of the project (if any)</td></tr>""" """<tr><td>path_name</td>""" """<td>full path of the current file</td></tr>""" """<tr><td>dir_name</td>""" """<td>full path of the parent directory</td></tr>""" """<tr><td>file_name</td>""" """<td>the current file name (without directory)</td></tr>""" """<tr><td>base_name</td>""" """<td>like <i>file_name</i>, but without extension</td></tr>""" """<tr><td>ext</td>""" """<td>the extension of the current file</td></tr>""" """</table></p>""" """<p>If you want to change the default delimiter to anything""" """ different, please use the configuration dialog to do so.</p>"""))
def __stealLock(self): """ Private slot to handle the Break Lock context menu entry. """ names = [os.path.join(self.dname, unicode(itm.text(self.__pathColumn))) \ for itm in self.__getLockActionItems(self.stealBreakLockIndicators)] if not names: KQMessageBox.information(self, self.trUtf8("Steal Lock"), self.trUtf8("""There are no locked files available/selected.""")) return self.vcs.svnLock(names, parent=self, stealIt=True) self.on_refreshButton_clicked()
def __downloadPluginsDone(self): """ Private method called, when the download of the plugins is finished. """ self.__downloadButton.setEnabled(len(self.__selectedItems())) self.__installButton.setEnabled(True) self.__doneMethod = None KQMessageBox.information(None, self.trUtf8("Download Plugin Files"), self.trUtf8("""The requested plugins were downloaded.""")) self.downloadProgress.setValue(0) # repopulate the list to update the refresh icons self.__populateList()
def __showHelp(self): """ Private method to show some help. """ KQMessageBox.information(self, self.trUtf8("Template Help"), self.trUtf8("""<p><b>Template groups</b> are a means of grouping individual""" """ templates. Groups have an attribute that specifies,""" """ which programming language they apply for.""" """ In order to add template entries, at least one group""" """ has to be defined.</p>""" """<p><b>Template entries</b> are the actual templates.""" """ They are grouped by the template groups. Help about""" """ how to define them is available in the template edit""" """ dialog.</p>"""))
def __restoreMissing(self): """ Private slot to handle the Restore Missing context menu entry. """ names = [os.path.join(self.dname, unicode(itm.text(self.__pathColumn))) \ for itm in self.__getMissingItems()] if not names: KQMessageBox.information(self, self.trUtf8("Revert"), self.trUtf8("""There are no missing items available/selected.""")) return self.vcs.vcsRevert(names) self.on_refreshButton_clicked() self.vcs.checkVCSStatus()
def __removeFromChangelist(self): """ Private slot to remove entries from their changelists. """ names = [os.path.join(self.dname, unicode(itm.text(self.__pathColumn))) \ for itm in self.__getChangelistItems()] if not names: KQMessageBox.information(self, self.trUtf8("Remove from Changelist"), self.trUtf8( """There are no files available/selected belonging to a changelist.""" ) ) return self.vcs.svnRemoveFromChangelist(names) self.on_refreshButton_clicked()
def __activateFilter(self, on): """ Private slot to handle the "Filtered display" context menu entry. @param on flag indicating the filter state (boolean) """ if on and not self.taskFilter.hasActiveFilter(): res = KQMessageBox.information(None, self.trUtf8("Activate task filter"), self.trUtf8("""The task filter doesn't have any active filters.""" """ Do you want to configure the filter settings?"""), QMessageBox.StandardButtons(\ QMessageBox.No | \ QMessageBox.Yes), QMessageBox.Yes) if res != QMessageBox.Yes: on = False else: self.__configureFilter() on = self.taskFilter.hasActiveFilter() self.taskFilter.setActive(on) self.__menuFilteredAct.setChecked(on) self.__backMenuFilteredAct.setChecked(on) self.__refreshDisplay()
def on_testButton_clicked(self): """ Private slot to test the mail server login data. """ QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) QApplication.processEvents() try: server = smtplib.SMTP(str(self.mailServerEdit.text()), self.portSpin.value(), timeout=10) if self.useTlsCheckBox.isChecked(): server.starttls() try: server.login(unicode(self.mailUserEdit.text()), unicode(self.mailPasswordEdit.text())) QApplication.restoreOverrideCursor() KQMessageBox.information(self, self.trUtf8("Login Test"), self.trUtf8("""The login test succeeded.""")) except (smtplib.SMTPException, socket.error) as e: QApplication.restoreOverrideCursor() if isinstance(e, smtplib.SMTPResponseException): errorStr = e.smtp_error.decode() elif isinstance(e, socket.timeout): errorStr = str(e) elif isinstance(e, socket.error): errorStr = e[1] else: errorStr = str(e) KQMessageBox.critical(self, self.trUtf8("Login Test"), self.trUtf8("""<p>The login test failed.<br>Reason: %1</p>""") .arg(errorStr)) server.quit() except (smtplib.SMTPException, socket.error) as e: QApplication.restoreOverrideCursor() if isinstance(e, smtplib.SMTPResponseException): errorStr = e.smtp_error.decode() elif isinstance(e, socket.timeout): errorStr = str(e) elif isinstance(e, socket.error): errorStr = e[1] else: errorStr = str(e) KQMessageBox.critical(self, self.trUtf8("Login Test"), self.trUtf8("""<p>The login test failed.<br>Reason: %1</p>""") .arg(errorStr))
def __revert(self): """ Private slot to handle the Revert context menu entry. """ names = [os.path.join(self.dname, unicode(itm.text(self.__pathColumn))) \ for itm in self.__getModifiedItems()] if not names: KQMessageBox.information(self, self.trUtf8("Revert"), self.trUtf8("""There are no uncommitted changes available/selected.""")) return self.vcs.vcsRevert(names) self.raise_() self.activateWindow() self.on_refreshButton_clicked() self.vcs.checkVCSStatus()
def __commit(self): """ Private slot to handle the Commit context menu entry. """ names = [os.path.join(self.dname, unicode(itm.text(self.__pathColumn))) \ for itm in self.__getCommitableItems()] if not names: KQMessageBox.information(self, self.trUtf8("Commit"), self.trUtf8("""There are no items selected to be committed.""")) return if Preferences.getVCS("AutoSaveFiles"): vm = e4App().getObject("ViewManager") for name in names: vm.saveEditor(name) self.vcs.vcsCommit(names, '')
def __diff(self): """ Private slot to handle the Diff context menu entry. """ names = [os.path.join(self.dname, unicode(itm.text(self.__pathColumn))) \ for itm in self.__getModifiedItems()] if not names: KQMessageBox.information(self, self.trUtf8("Differences"), self.trUtf8("""There are no uncommitted changes available/selected.""")) return if self.diff is None: self.diff = SvnDiffDialog(self.vcs) self.diff.show() QApplication.processEvents() self.diff.start(names)
def __add(self): """ Private slot to handle the Add context menu entry. """ names = [os.path.join(self.dname, unicode(itm.text(self.__pathColumn))) \ for itm in self.__getUnversionedItems()] if not names: KQMessageBox.information(self, self.trUtf8("Add"), self.trUtf8("""There are no unversioned entries available/selected.""")) return self.vcs.vcsAdd(names) self.on_refreshButton_clicked() project = e4App().getObject("Project") for name in names: project.getModel().updateVCSStatus(name)
def on_loadButton_clicked(self): """ Private slot to load a regexp from a file. """ fname = KQFileDialog.getOpenFileName(\ self, self.trUtf8("Load regular expression"), QString(), self.trUtf8("RegExp Files (*.rx);;All Files (*)"), None) if not fname.isEmpty(): try: f=open(unicode(Utilities.toNativeSeparators(fname)), "rb") regexp = f.read() f.close() self.regexpLineEdit.setText(regexp) except IOError, err: KQMessageBox.information(self, self.trUtf8("Save regular expression"), self.trUtf8("""<p>The regular expression could not be saved.</p>""" """<p>Reason: %1</p>""").arg(str(err)))
def __releaseTSFileDone(self, exitCode, exitStatus): """ Private slot to handle the finished signal of the lrelease process. """ if exitStatus == QProcess.NormalExit and exitCode == 0: KQMessageBox.information(None, self.trUtf8("Translation file release"), self.trUtf8("The release of the translation files (*.qm)" " was successful.")) if self.project.pdata["TRANSLATIONSBINPATH"] and \ self.project.pdata["TRANSLATIONSBINPATH"][0]: target = os.path.join(self.project.ppath, self.project.pdata["TRANSLATIONSBINPATH"][0]) for langFile in self.project.pdata["TRANSLATIONS"][:]: if langFile.endswith('.ts'): qmFile = os.path.join(self.project.ppath, langFile.replace('.ts', '.qm')) if os.path.exists(qmFile): shutil.move(qmFile, target) else: KQMessageBox.critical(None, self.trUtf8("Translation file release"), self.trUtf8("The release of the translation files (*.qm) has failed.")) proc = self.sender() for index in range(len(self.__lreleaseProcesses)): if proc == self.__lreleaseProcesses[index][0]: try: self.__tmpProjects.remove( self.__lreleaseProcesses[index][1]) os.remove(self.__lreleaseProcesses[index][1]) except EnvironmentError: pass del self.__lreleaseProcesses[index] break if not self.__lreleaseProcesses: # all done self.lreleaseProcRunning = False self.project.checkLanguageFiles()
def on_saveButton_clicked(self): """ Private slot to save the regexp to a file. """ selectedFilter = QString("") fname = KQFileDialog.getSaveFileName(\ self, self.trUtf8("Save regular expression"), QString(), self.trUtf8("RegExp Files (*.rx);;All Files (*)"), selectedFilter, QFileDialog.Options(QFileDialog.DontConfirmOverwrite)) if not fname.isEmpty(): ext = QFileInfo(fname).suffix() if ext.isEmpty(): ex = selectedFilter.section('(*', 1, 1).section(')', 0, 0) if not ex.isEmpty(): fname.append(ex) if QFileInfo(fname).exists(): res = KQMessageBox.warning(self, self.trUtf8("Save regular expression"), self.trUtf8("<p>The file <b>%1</b> already exists.</p>") .arg(fname), QMessageBox.StandardButtons(\ QMessageBox.Abort | \ QMessageBox.Save), QMessageBox.Abort) if res == QMessageBox.Abort or res == QMessageBox.Cancel: return try: f=open(unicode(Utilities.toNativeSeparators(fname)), "wb") f.write(unicode(self.regexpLineEdit.text())) f.close() except IOError, err: KQMessageBox.information(self, self.trUtf8("Save regular expression"), self.trUtf8("""<p>The regular expression could not be saved.</p>""" """<p>Reason: %1</p>""").arg(str(err)))
def on_validateButton_clicked(self): """ Private slot to validate the entered regexp. """ regex = unicode(self.regexpTextEdit.toPlainText()) if regex: try: flags = 0 if not self.caseSensitiveCheckBox.isChecked(): flags |= re.IGNORECASE if self.multilineCheckBox.isChecked(): flags |= re.MULTILINE if self.dotallCheckBox.isChecked(): flags |= re.DOTALL if self.verboseCheckBox.isChecked(): flags |= re.VERBOSE if self.py2Button.isChecked(): if self.localeCheckBox.isChecked(): flags |= re.LOCALE if self.unicodeCheckBox.isChecked(): flags |= re.UNICODE else: if self.unicodeCheckBox.isChecked(): flags |= re.ASCII re.compile(regex, flags) KQMessageBox.information(None, self.trUtf8(""), self.trUtf8("""The regular expression is valid.""")) except re.error, e: KQMessageBox.critical(None, self.trUtf8("Error"), self.trUtf8("""Invalid regular expression: %1""") .arg(str(e))) return except IndexError: KQMessageBox.critical(None, self.trUtf8("Error"), self.trUtf8("""Invalid regular expression: missing group name""")) return
def __doReplace(self, searchNext): """ Private method to replace one occurrence of text. @param searchNext flag indicating to search for the next occurrence (boolean). """ self.__finding = True # Check enabled status due to dual purpose usage of this method if not self.ui.replaceButton.isEnabled() and \ not self.ui.replaceSearchButton.isEnabled(): return ftxt = self.ui.findtextCombo.currentText() rtxt = self.ui.replacetextCombo.currentText() # This moves any previous occurrence of this statement to the head # of the list and updates the combobox self.replaceHistory.removeAll(rtxt) self.replaceHistory.prepend(rtxt) self.ui.replacetextCombo.clear() self.ui.replacetextCombo.addItems(self.replaceHistory) aw = self.viewmanager.activeWindow() aw.replace(rtxt) if searchNext: ok = self.__findNextPrev(ftxt, self.__findBackwards) if not ok: self.ui.replaceButton.setEnabled(False) self.ui.replaceSearchButton.setEnabled(False) KQMessageBox.information(self, self.windowTitle(), self.trUtf8("'%1' was not found.").arg(ftxt)) else: self.ui.replaceButton.setEnabled(False) self.ui.replaceSearchButton.setEnabled(False) self.__finding = False
def _vcsUpdate(self): """ Protected slot used to update the local project from the repository. """ shouldReopen = self.vcs.vcsUpdate(self.project.ppath) if shouldReopen: res = KQMessageBox.information(None, self.trUtf8("Update"), self.trUtf8("""The project should be reread. Do this now?"""), QMessageBox.StandardButtons(\ QMessageBox.No | \ QMessageBox.Yes), QMessageBox.Yes) if res == QMessageBox.Yes: self.project.reopenProject()
def on_removeButton_clicked(self): """ Private slot to remove a document from the help database. """ res = KQMessageBox.question(None, self.trUtf8("Remove Documentation"), self.trUtf8("""Do you really want to remove the selected documentation """ """sets from the database?"""), QMessageBox.StandardButtons(\ QMessageBox.No | \ QMessageBox.Yes), QMessageBox.No) if res == QMessageBox.No: return openedDocs = self.__mw.getSourceFileList() items = self.documentsList.selectedItems() for item in items: ns = item.text() if ns in openedDocs.values(): res = KQMessageBox.information(self, self.trUtf8("Remove Documentation"), self.trUtf8("""Some documents currently opened reference the """ """documentation you are attempting to remove. """ """Removing the documentation will close those """ """documents."""), QMessageBox.StandardButtons(\ QMessageBox.Cancel | \ QMessageBox.Ok)) if res == QMessageBox.Cancel: return self.__unregisteredDocs.append(ns) for id in openedDocs: if openedDocs[id] == ns and id not in self.__tabsToClose: self.__tabsToClose.append(id) itm = self.documentsList.takeItem(self.documentsList.row(item)) del itm self.__engine.unregisterDocumentation(ns) if self.documentsList.count(): self.documentsList.setCurrentRow(0, QItemSelectionModel.ClearAndSelect)
def on_replaceAllButton_clicked(self): """ Private slot to replace all occurrences of text. """ self.__finding = True replacements = 0 ftxt = self.ui.findtextCombo.currentText() rtxt = self.ui.replacetextCombo.currentText() # This moves any previous occurrence of this statement to the head # of the list and updates the combobox self.findHistory.removeAll(ftxt) self.findHistory.prepend(ftxt) self.ui.findtextCombo.clear() self.ui.findtextCombo.addItems(self.findHistory) self.replaceHistory.removeAll(rtxt) self.replaceHistory.prepend(rtxt) self.ui.replacetextCombo.clear() self.ui.replacetextCombo.addItems(self.replaceHistory) aw = self.viewmanager.activeWindow() cline, cindex = aw.getCursorPosition() if self.ui.selectionCheckBox.isChecked(): line = self.__selection[0] index = self.__selection[1] else: line = 0 index = 0 ok = aw.findFirst(ftxt, self.ui.regexpCheckBox.isChecked(), self.ui.caseCheckBox.isChecked(), self.ui.wordCheckBox.isChecked(), False, True, line, index) if ok and self.ui.selectionCheckBox.isChecked(): lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() if (lineFrom == self.__selection[0] and indexFrom >= self.__selection[1]) or \ (lineFrom > self.__selection[0] and lineFrom < self.__selection[2]) or \ (lineFrom == self.__selection[2] and indexFrom <= self.__selection[3]): ok = True else: ok = False aw.selectAll(False) aw.setCursorPosition(cline, cindex) aw.ensureCursorVisible() found = ok aw.beginUndoAction() wordWrap = self.ui.wrapCheckBox.isChecked() self.ui.wrapCheckBox.setChecked(False) while ok: aw.replace(rtxt) replacements += 1 ok = self.__findNextPrev(ftxt, self.__findBackwards) self.__finding = True aw.endUndoAction() if wordWrap: self.ui.wrapCheckBox.setChecked(True) self.ui.replaceButton.setEnabled(False) self.ui.replaceSearchButton.setEnabled(False) if found: KQMessageBox.information(self, self.windowTitle(), self.trUtf8("Replaced %1 occurrences.") .arg(replacements)) else: KQMessageBox.information(self, self.windowTitle(), self.trUtf8("Nothing replaced because '%1' was not found.") .arg(ftxt)) aw.setCursorPosition(cline, cindex) aw.ensureCursorVisible() self.__finding = False