def entryChanged(self, entry, *args): text = split(entry.get_text()) format = '<b><u>%s</u></b>' for row in self.model: row[1] = relevance.formatCommonSubstrings(row[0], text, format) row[3] = float(relevance.score(row[2], text)) * 100.0 iter = self.treeview.get_model().get_iter_first() if iter: self.treeview.get_selection().select_iter(iter)
def update_score(model, path, _iter): global search, timeout timeout = 0 if not search: return text, = model.get(_iter, 0) score = 0 if text: score = relevance.score(text, search) model.set_value(_iter, 2, score)
def filterFiles(self, text, files): for file in files: score = relevance.score(file, text) if score > 0: add = True for pattern in self.getExcludeFilter().split(' '): if fnmatch(file, pattern): add = False break includeFilter = self.getIncludeFilter() if includeFilter: for pattern in includeFilter.split(' '): if fnmatch(file, pattern): add = True break else: add = False if add: yield file, score