def search(self, key=u"", context=None, text_mode=False): """ filter for action @item """ self.latest_key = key sources = [] if not text_mode or hasattr(self.get_source(), "get_text_items"): sources.append(self.get_source()) if key and self.is_at_source_root(): # Only use text sources when we are at root catalog sc = GetSourceController() textsrcs = sc.get_text_sources() sources.extend(textsrcs) item_check = actioncompat.iobjects_valid_for_action(self.current_action, self.current_item) decorator = lambda seq: dress_leaves(seq, action=self.current_action) match, match_iter = self.searcher.search(sources, key, score=True, item_check=item_check, decorator=decorator) self.emit_search_result(match, match_iter, context)
def search(self, key="", context=None, text_mode=False): """ filter for action @item """ self.latest_key = key sources = [] if not text_mode or hasattr(self.get_source(), "get_text_items"): sources.append(self.get_source()) if key and self.is_at_source_root(): # Only use text sources when we are at root catalog sc = GetSourceController() textsrcs = sc.get_text_sources() sources.extend(textsrcs) item_check = actioncompat.iobjects_valid_for_action(self.current_action, self.current_item) decorator = lambda seq: dress_leaves(seq, action=self.current_action) match, match_iter = self.searcher.search(sources, key, score=True, item_check=item_check, decorator=decorator) self.emit_search_result(match, match_iter, context)
def search(self, key=u"", context=None, text_mode=False): """ filter for action @item """ self.latest_key = key sources = [] if not text_mode or isinstance(self.get_source(), base.TextSource): sources.append(self.get_source()) if key and self.is_at_source_root(): # Only use text sources when we are at root catalog sc = GetSourceController() textsrcs = sc.get_text_sources() sources.extend(textsrcs) types = tuple(self.current_action.object_types()) def type_obj_check(itms): valid_object = self.current_action.valid_object item = self.current_item for i in itms: if (isinstance(i, types) and valid_object(i, for_item=item)): yield i def type_check(itms): for i in itms: if isinstance(i, types): yield i if hasattr(self.current_action, "valid_object"): item_check = type_obj_check else: item_check = type_check decorator = lambda seq: dress_leaves(seq, action=self.current_action) match, match_iter = self.searcher.search(sources, key, score=True, item_check=item_check, decorator=decorator) self.emit_search_result(match, match_iter, context)