def InitView(self): if not self._no_daemons: self._daemons.append( HydrusThreading.DAEMONWorker(self, 'SleepCheck', HydrusDaemons.DAEMONSleepCheck, period=120)) self._daemons.append( HydrusThreading.DAEMONWorker( self, 'MaintainMemoryFast', HydrusDaemons.DAEMONMaintainMemoryFast, period=60)) self._daemons.append( HydrusThreading.DAEMONWorker( self, 'MaintainMemorySlow', HydrusDaemons.DAEMONMaintainMemorySlow, period=300)) self._daemons.append( HydrusThreading.DAEMONBackgroundWorker( self, 'MaintainDB', HydrusDaemons.DAEMONMaintainDB, period=300, init_wait=60))
def InitView( self ): if not self._no_daemons: self._daemons.append( HydrusThreading.DAEMONBackgroundWorker( self, 'MaintainDB', HydrusDaemons.DAEMONMaintainDB, period = 300, init_wait = 60 ) ) self.CallRepeating( 10.0, 120.0, self.SleepCheck ) self.CallRepeating( 10.0, 60.0, self.MaintainMemoryFast ) self.CallRepeating( 10.0, 300.0, self.MaintainMemorySlow )
def InitView( self ): if self.options[ 'password' ] is not None: self.pub( 'splash_set_status_text', 'waiting for password' ) def wx_code_password(): while True: with wx.PasswordEntryDialog( self._splash, 'Enter your password', 'Enter password' ) as dlg: if dlg.ShowModal() == wx.ID_OK: # this can produce unicode with cyrillic or w/e keyboards, which hashlib can't handle password = HydrusData.ToByteString( dlg.GetValue() ) if hashlib.sha256( password ).digest() == self.options[ 'password' ]: break else: raise HydrusExceptions.PermissionException( 'Bad password check' ) self.CallBlockingToWx( wx_code_password ) self.pub( 'splash_set_title_text', u'booting gui\u2026' ) def wx_code_gui(): self.gui = ClientGUI.FrameGUI( self ) self.ResetIdleTimer() self.CallBlockingToWx( wx_code_gui ) # ShowText will now popup as a message, as popup message manager has overwritten the hooks HydrusController.HydrusController.InitView( self ) self._booru_port_connection = None self.RestartBooru() if not self._no_daemons: self._daemons.append( HydrusThreading.DAEMONWorker( self, 'CheckMouseIdle', ClientDaemons.DAEMONCheckMouseIdle, period = 10 ) ) self._daemons.append( HydrusThreading.DAEMONWorker( self, 'SynchroniseAccounts', ClientDaemons.DAEMONSynchroniseAccounts, ( 'notify_unknown_accounts', ) ) ) self._daemons.append( HydrusThreading.DAEMONWorker( self, 'SaveDirtyObjects', ClientDaemons.DAEMONSaveDirtyObjects, ( 'important_dirt_to_clean', ), period = 30 ) ) self._daemons.append( HydrusThreading.DAEMONForegroundWorker( self, 'DownloadFiles', ClientDaemons.DAEMONDownloadFiles, ( 'notify_new_downloads', 'notify_new_permissions' ) ) ) self._daemons.append( HydrusThreading.DAEMONForegroundWorker( self, 'SynchroniseSubscriptions', ClientDaemons.DAEMONSynchroniseSubscriptions, ( 'notify_restart_subs_sync_daemon', 'notify_new_subscriptions' ), period = 14400, init_wait = 60, pre_call_wait = 3 ) ) self._daemons.append( HydrusThreading.DAEMONForegroundWorker( self, 'CheckImportFolders', ClientDaemons.DAEMONCheckImportFolders, ( 'notify_restart_import_folders_daemon', 'notify_new_import_folders' ), period = 180 ) ) self._daemons.append( HydrusThreading.DAEMONForegroundWorker( self, 'CheckExportFolders', ClientDaemons.DAEMONCheckExportFolders, ( 'notify_restart_export_folders_daemon', 'notify_new_export_folders' ), period = 180 ) ) self._daemons.append( HydrusThreading.DAEMONForegroundWorker( self, 'MaintainTrash', ClientDaemons.DAEMONMaintainTrash, init_wait = 120 ) ) self._daemons.append( HydrusThreading.DAEMONForegroundWorker( self, 'SynchroniseRepositories', ClientDaemons.DAEMONSynchroniseRepositories, ( 'notify_restart_repo_sync_daemon', 'notify_new_permissions' ), period = 4 * 3600, pre_call_wait = 1 ) ) self._daemons.append( HydrusThreading.DAEMONBackgroundWorker( self, 'UPnP', ClientDaemons.DAEMONUPnP, ( 'notify_new_upnp_mappings', ), init_wait = 120, pre_call_wait = 6 ) ) if self.db.IsFirstStart(): message = 'Hi, this looks like the first time you have started the hydrus client.' message += os.linesep * 2 message += 'Don\'t forget to check out the help if you haven\'t already.' message += os.linesep * 2 message += 'To dismiss popup messages like this, right-click them.' HydrusData.ShowText( message ) if self.db.IsDBUpdated(): HydrusData.ShowText( 'The client has updated to version ' + str( HC.SOFTWARE_VERSION ) + '!' ) for message in self.db.GetInitialMessages(): HydrusData.ShowText( message )