How to use the hydrus.core.HydrusGlobals.client_controller.pub function in hydrus

To help you get started, we’ve selected a few hydrus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUISearch.py View on Github external
def _BroadcastCollect( self ):
        
        if not self._silent and self._management_controller is not None:
            
            self._management_controller.SetVariable( 'media_collect', self._media_collect )
            
            page_key = self._management_controller.GetKey( 'page' )
            
            HG.client_controller.pub( 'collect_media', page_key, self._media_collect )
            HG.client_controller.pub( 'a_collect_happened', page_key )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIPages.py View on Github external
def AppendGUISession( self, name, load_in_a_page_of_pages = True ):
        
        job_key = ClientThreading.JobKey()
        
        job_key.SetVariable( 'popup_text_1', 'loading session "{}"\u2026'.format( name ) )
        
        HG.client_controller.pub( 'message', job_key )
        
        # get that message showing before we do the work of loading session
        HG.client_controller.app.processEvents()
        
        try:
            
            session = self._controller.Read( 'serialisable_named', HydrusSerialisable.SERIALISABLE_TYPE_GUI_SESSION, name )
            
        except Exception as e:
            
            HydrusData.ShowText( 'While trying to load session ' + name + ', this error happened:' )
            HydrusData.ShowException( e )
            
            self.NewPageQuery( CC.LOCAL_FILE_SERVICE_KEY )
            
            return
github hydrusnetwork / hydrus / hydrus / client / importing / ClientImportGallerySeeds.py View on Github external
def NotifyGallerySeedsUpdated( self, gallery_seeds ):
        
        with self._lock:
            
            self._SetStatusDirty()
            
        
        HG.client_controller.pub( 'gallery_seed_log_gallery_seeds_updated', self._gallery_seed_log_key, gallery_seeds )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIPanels.py View on Github external
def _CopyAccountKey( self ):
            
            account = self._service.GetAccount()
            
            account_key = account.GetAccountKey()
            
            account_key_hex = account_key.hex()
            
            HG.client_controller.pub( 'clipboard', 'text', account_key_hex )
github hydrusnetwork / hydrus / hydrus / client / gui / lists / ClientGUIListBoxes.py View on Github external
def _ExportToClipboard( self ):
        
        export_object = self._GetExportObject()
        
        if export_object is not None:
            
            json = export_object.DumpToString()
            
            HG.client_controller.pub( 'clipboard', 'text', json )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIGallerySeedLog.py View on Github external
def _ExportToClipboard( self ):
        
        payload = self._GetExportableURLsString()
        
        HG.client_controller.pub( 'clipboard', 'text', payload )
github hydrusnetwork / hydrus / hydrus / client / ClientData.py View on Github external
else:
            
            try: job_key.SetVariable( 'popup_title', str( etype.__name__ ) )
            except: job_key.SetVariable( 'popup_title', str( etype ) )
            
            job_key.SetVariable( 'popup_text_1', first_line )
            job_key.SetVariable( 'popup_traceback', trace )
            
        
        text = job_key.ToString()
        
        HydrusData.Print( 'Uncaught exception:' )
        
        HydrusData.DebugPrint( text )
        
        HG.client_controller.pub( 'message', job_key )
        
    except:
        
        text = 'Encountered an error I could not parse:'
        
        text += os.linesep
        
        text += str( ( etype, value, tb ) )
        
        try: text += traceback.format_exc()
        except: pass
        
        HydrusData.ShowText( text )
        
    
    time.sleep( 1 )
github hydrusnetwork / hydrus / hydrus / client / gui / lists / ClientGUIListBoxes.py View on Github external
predicates = ClientGUISearch.FleshOutPredicates( self, predicates )
        
        if len( predicates ) > 0:
            
            s = sorted( ( predicate.ToString() for predicate in predicates ) )
            
            page_name = ', '.join( s )
            
            activate_window = HG.client_controller.new_options.GetBoolean( 'activate_window_on_tag_search_page_activation' )
            
            file_service_key = self._GetCurrentFileServiceKey()
            
            HG.client_controller.pub( 'new_page_query', file_service_key, initial_predicates = predicates, page_name = page_name, activate_window = activate_window )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIFileSeedCache.py View on Github external
if show == 'all':
            
            hashes = file_seed_cache.GetHashes()
            
        elif show == 'new':
            
            file_import_options = ClientImportOptions.FileImportOptions()
            
            file_import_options.SetPresentationOptions( True, False, False )
            
            hashes = file_seed_cache.GetPresentedHashes( file_import_options )
            
        
        if len( hashes ) > 0:
            
            HG.client_controller.pub( 'new_page_query', CC.LOCAL_FILE_SERVICE_KEY, initial_hashes = hashes )
github hydrusnetwork / hydrus / hydrus / client / gui / ClientGUIPanels.py View on Github external
message = 'This will instruct your database to forget its entire record of locally deleted files, meaning that if it ever encounters any of those files again, it will assume they are new and reimport them. This operation cannot be undone.'
            
            result = ClientGUIDialogsQuick.GetYesNo( self, message, yes_label = 'do it', no_label = 'forget it' )
            
            if result == QW.QDialog.Accepted:
                
                hashes = None
                
                content_update = HydrusData.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_ADVANCED, ( 'delete_deleted', hashes ) )
                
                service_keys_to_content_updates = { CC.COMBINED_LOCAL_FILE_SERVICE_KEY : [ content_update ] }
                
                HG.client_controller.Write( 'content_updates', service_keys_to_content_updates )
                
                HG.client_controller.pub( 'service_updated', self._service )