Beispiel #1
0
    def _ParseSearchText(self):

        raw_entry = self._text_ctrl.GetValue()

        tag = HydrusTags.CleanTag(raw_entry)

        search_text = ClientSearch.ConvertEntryTextToSearchText(raw_entry)

        if ClientSearch.IsComplexWildcard(search_text):

            cache_text = None

        else:

            cache_text = search_text[:
                                     -1]  # take off the trailing '*' for the cache text

        entry_predicate = ClientSearch.Predicate(HC.PREDICATE_TYPE_TAG, tag)

        siblings_manager = HG.client_controller.GetManager('tag_siblings')

        sibling = siblings_manager.GetSibling(self._tag_service_key, tag)

        if sibling is not None:

            sibling_predicate = ClientSearch.Predicate(HC.PREDICATE_TYPE_TAG,
                                                       sibling)

        else:

            sibling_predicate = None

        return (search_text, cache_text, entry_predicate, sibling_predicate)
Beispiel #2
0
    def _ParseSearchText(self):

        raw_entry = self._text_ctrl.GetValue()

        if raw_entry.startswith('-'):

            inclusive = False

            entry_text = raw_entry[1:]

        else:

            inclusive = True

            entry_text = raw_entry

        tag = HydrusTags.CleanTag(entry_text)

        explicit_wildcard = '*' in entry_text

        search_text = ClientSearch.ConvertEntryTextToSearchText(entry_text)

        if explicit_wildcard:

            cache_text = None

            entry_predicate = ClientSearch.Predicate(
                HC.PREDICATE_TYPE_WILDCARD, search_text, inclusive)

        else:

            cache_text = search_text[:
                                     -1]  # take off the trailing '*' for the cache text

            siblings_manager = HydrusGlobals.client_controller.GetManager(
                'tag_siblings')

            sibling = siblings_manager.GetSibling(self._tag_service_key, tag)

            if sibling is None:

                entry_predicate = ClientSearch.Predicate(
                    HC.PREDICATE_TYPE_TAG, tag, inclusive)

            else:

                entry_predicate = ClientSearch.Predicate(
                    HC.PREDICATE_TYPE_TAG, sibling, inclusive)

        return (inclusive, search_text, explicit_wildcard, cache_text,
                entry_predicate)