def processFind(self): match_obj = controller.search() if match_obj is None: self.ui.tebMatch.setPlainText("No Match") self.ui.tebMatchAll.setPlainText("No Match") self.ui.statusbar.showMessage("No Match", 0) else: self.populate_match_textbrowser() self.populate_matchAll_textbrowser()
def populate_match_textbrowser(self): match_obj = controller.search() startpos = match_obj.start() endpos = match_obj.end() pre = post = match = "" match = controller.matchString[startpos:endpos] # prepend the beginning that didn't match if startpos > 0: pre = controller.matchString[0:startpos] # append the end that didn't match if endpos < len(controller.matchString): post = controller.matchString[endpos:] self.ui.tebMatch.setHtml(pre + self.highlightStart + match + self.highlightEnd + post)