def filter_cb(self): filtered = False cmd_sel = self.cmd_items[self.last_minx.column()] res = DialogManager.show_filter_dialog(self.cmd_items, cmd_sel) if res == None: return (filter_text, is_regex, is_negate, is_ignorecase, cmd_sel) = res cmd_idx = self.cmd_items.index(cmd_sel) if cmd_idx == -1: return for inx in range(self.topLevelItemCount()): item = self.topLevelItem(inx) text = item.column_val(cmd_idx) if (text == None): continue matched = False if (is_regex): if (is_ignorecase): if (re.search(filter_text, text, re.I) != None): matched = True else: if (re.search(filter_text, text) != None): matched = True else: if (is_ignorecase): if (text.upper().find(filter_text.upper()) != -1): matched = True else: if (text.find(filter_text) != -1): matched = True if (is_negate): matched = not matched if not matched: item.setHidden(True) filtered = True if filtered: self.mark_tab_filtered(True)
def filter_cb(self): filtered = False cmd_sel = self.cmd_items[self.last_minx.column()] res = DialogManager.show_filter_dialog(self.cmd_items,cmd_sel) if res == None: return (filter_text, is_regex, is_negate, is_ignorecase, cmd_sel) = res cmd_idx = self.cmd_items.index(cmd_sel) if cmd_idx == -1: return for inx in range(self.topLevelItemCount()): item = self.topLevelItem(inx) text = item.column_val(cmd_idx) if (text == None): continue matched = False if (is_regex): if (is_ignorecase): if (re.search(filter_text, text, re.I) != None): matched = True else: if (re.search(filter_text, text) != None): matched = True else: if (is_ignorecase): if (text.upper().find(filter_text.upper()) != -1): matched = True else: if (text.find(filter_text) != -1): matched = True if (is_negate): matched = not matched if not matched: self.setItemHidden(item, True) filtered = True if filtered: self.mark_tab_filtered(True)