def _FetchRelatedTags(self, max_time_to_take):

        (m, ) = self._media

        hash = m.GetHash()

        (current_tags_to_count, deleted_tags_to_count, pending_tags_to_count,
         petitioned_tags_to_count) = ClientData.GetMediasTagCount(
             self._media,
             tag_service_key=self._service_key,
             collapse_siblings=False)

        tags_to_count = collections.Counter()

        tags_to_count.update(current_tags_to_count)
        tags_to_count.update(pending_tags_to_count)

        search_tags = set(tags_to_count.keys())

        max_results = 100

        predicates = HydrusGlobals.client_controller.Read(
            'related_tags', self._service_key, hash, search_tags, max_results,
            max_time_to_take)

        predicates = ClientSearch.SortPredicates(predicates)

        self._related_tags.SetPredicates(predicates)
Beispiel #2
0
 def _FetchRelatedTags( self, max_time_to_take ):
     
     def do_it( service_key ):
         
         def wx_code():
             
             if not self:
                 
                 return
                 
             
             self._related_tags.SetPredicates( predicates )
             
         
         predicates = HG.client_controller.Read( 'related_tags', service_key, hash, search_tags, max_results, max_time_to_take )
         
         predicates = ClientSearch.SortPredicates( predicates )
         
         wx.CallAfter( wx_code )
         
     
     ( m, ) = self._media
     
     hash = m.GetHash()
     
     ( current_tags_to_count, deleted_tags_to_count, pending_tags_to_count, petitioned_tags_to_count ) = ClientData.GetMediasTagCount( self._media, tag_service_key = self._service_key, collapse_siblings = False )
     
     tags_to_count = collections.Counter()
     
     tags_to_count.update( current_tags_to_count )
     tags_to_count.update( pending_tags_to_count )
     
     search_tags = set( tags_to_count.keys() )
     
     max_results = 100
     
     HG.client_controller.CallToThread( do_it, self._service_key )