コード例 #1
0
 def ExpandPredicate( self, service_key: bytes, predicate: ClientSearch.Predicate, service_strict: bool = False ):
     
     if not service_strict and self._controller.new_options.GetBoolean( 'apply_all_siblings_to_all_services' ):
         
         service_key = CC.COMBINED_TAG_SERVICE_KEY
         
     
     ideal_sibling_predicate = predicate
     other_sibling_predicates = []
     
     if predicate.GetType() == ClientSearch.PREDICATE_TYPE_TAG:
         
         tag = predicate.GetValue()
         
         ideal_sibling = self.CollapseTag( service_key, tag, service_strict = service_strict )
         
         ideal_sibling_predicate = ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_TAG, ideal_sibling, predicate.IsInclusive() )
         
         other_siblings = set( self.GetAllSiblings( service_key, tag, service_strict = service_strict ) )
         
         other_siblings.discard( tag )
         other_siblings.discard( ideal_sibling )
         
         other_sibling_predicates = [ ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_TAG, sibling, predicate.IsInclusive() ) for sibling in other_siblings ]
         
         
     return ( ideal_sibling_predicate, other_sibling_predicates )
コード例 #2
0
    def __init__(self, parent: QW.QWidget, predicate: ClientSearch.Predicate):

        QW.QWidget.__init__(self, parent)

        from hydrus.client.gui.search import ClientGUIACDropdown

        if predicate.GetType() != ClientSearch.PREDICATE_TYPE_OR_CONTAINER:

            raise Exception(
                'Launched an ORPredicateControl without an OR Pred!')

        predicates = predicate.GetValue()

        page_key = HydrusData.GenerateKey()

        file_search_context = ClientSearch.FileSearchContext(
            file_service_key=CC.LOCAL_FILE_SERVICE_KEY, predicates=predicates)

        self._search_control = ClientGUIACDropdown.AutoCompleteDropdownTagsRead(
            self,
            page_key,
            file_search_context,
            hide_favourites_edit_actions=True)

        vbox = QP.VBoxLayout()

        QP.AddToLayout(vbox, self._search_control, CC.FLAGS_EXPAND_BOTH_WAYS)

        self.setLayout(vbox)
コード例 #3
0
 def ExpandPredicate( self, service_key: bytes, predicate: ClientSearch.Predicate ):
     
     ideal_sibling_predicate = predicate
     other_sibling_predicates = []
     
     if predicate.GetType() == ClientSearch.PREDICATE_TYPE_TAG:
         
         tag = predicate.GetValue()
         
         ideal_sibling = self.GetSibling( service_key, tag )
         
         ideal_sibling_predicate = ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_TAG, ideal_sibling, predicate.IsInclusive() )
         
         other_siblings = set( self.GetAllSiblings( service_key, tag ) )
         
         other_siblings.discard( tag )
         other_siblings.discard( ideal_sibling )
         
         other_sibling_predicates = [ ClientSearch.Predicate( ClientSearch.PREDICATE_TYPE_TAG, sibling, predicate.IsInclusive() ) for sibling in other_siblings ]
         
     
     return ( ideal_sibling_predicate, other_sibling_predicates )
コード例 #4
0
    def __init__(self, parent: QW.QWidget, predicate: ClientSearch.Predicate):

        QW.QWidget.__init__(self, parent)

        from hydrus.client.gui.search import ClientGUIACDropdown

        if predicate.GetType() != ClientSearch.PREDICATE_TYPE_OR_CONTAINER:

            raise Exception(
                'Launched an ORPredicateControl without an OR Pred!')

        predicates = predicate.GetValue()

        page_key = HydrusData.GenerateKey()

        location_context = HG.client_controller.new_options.GetDefaultLocalLocationContext(
        )

        file_search_context = ClientSearch.FileSearchContext(
            location_context=location_context, predicates=predicates)

        self._search_control = ClientGUIACDropdown.AutoCompleteDropdownTagsRead(
            self,
            page_key,
            file_search_context,
            hide_favourites_edit_actions=True)

        self._search_control.setMinimumWidth(
            ClientGUIFunctions.ConvertTextToPixelWidth(self._search_control,
                                                       64))

        vbox = QP.VBoxLayout()

        QP.AddToLayout(vbox, self._search_control, CC.FLAGS_EXPAND_BOTH_WAYS)

        self.setLayout(vbox)

        ClientGUIFunctions.SetFocusLater(self._search_control)