Exemple #1
0
 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, 'MaintainMemory', HydrusDaemons.DAEMONMaintainMemory, period = 300 ) )
         
         self._daemons.append( HydrusThreading.DAEMONBigJobWorker( self, 'MaintainDB', HydrusDaemons.DAEMONMaintainDB, period = 300 ) )
Exemple #2
0
    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:

                            if hashlib.sha256(dlg.GetValue()).digest(
                            ) == self._options['password']:
                                break

                        else:
                            raise HydrusExceptions.PermissionException(
                                'Bad password check')

            self.CallBlockingToWx(wx_code_password)

        self.pub('splash_set_title_text', 'booting gui...')

        def wx_code_gui():

            self._gui = ClientGUI.FrameGUI(self)

            # this is because of some bug in wx C++ that doesn't add these by default
            wx.richtext.RichTextBuffer.AddHandler(
                wx.richtext.RichTextHTMLHandler())
            wx.richtext.RichTextBuffer.AddHandler(
                wx.richtext.RichTextXMLHandler())

            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._local_service = None
        self._booru_service = None

        self.RestartServer()
        self.RestartBooru()

        if not self._no_daemons:

            self._daemons.append(
                HydrusThreading.DAEMONWorker(
                    self,
                    'CheckMouseIdle',
                    ClientDaemons.DAEMONCheckMouseIdle,
                    period=10))
            self._daemons.append(
                HydrusThreading.DAEMONWorker(
                    self, 'DownloadFiles', ClientDaemons.DAEMONDownloadFiles,
                    ('notify_new_downloads', 'notify_new_permissions')))
            self._daemons.append(
                HydrusThreading.DAEMONWorker(
                    self, 'SynchroniseAccounts',
                    ClientDaemons.DAEMONSynchroniseAccounts,
                    ('permissions_are_stale', )))
            self._daemons.append(
                HydrusThreading.DAEMONWorker(
                    self, 'SynchroniseSubscriptions',
                    ClientDaemons.DAEMONSynchroniseSubscriptions,
                    ('notify_restart_subs_sync_daemon',
                     'notify_new_subscriptions')))

            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'CheckImportFolders',
                    ClientDaemons.DAEMONCheckImportFolders,
                    ('notify_restart_import_folders_daemon',
                     'notify_new_import_folders'),
                    period=180))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'CheckExportFolders',
                    ClientDaemons.DAEMONCheckExportFolders,
                    ('notify_restart_export_folders_daemon',
                     'notify_new_export_folders'),
                    period=180))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'MaintainTrash',
                    ClientDaemons.DAEMONMaintainTrash,
                    init_wait=60))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'RebalanceClientFiles',
                    ClientDaemons.DAEMONRebalanceClientFiles,
                    period=3600))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'SynchroniseRepositories',
                    ClientDaemons.DAEMONSynchroniseRepositories,
                    ('notify_restart_repo_sync_daemon',
                     'notify_new_permissions'),
                    period=4 * 3600))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'UPnP',
                    ClientDaemons.DAEMONUPnP, ('notify_new_upnp_mappings', ),
                    init_wait=120,
                    pre_callable_wait=6))

            self._daemons.append(
                HydrusThreading.DAEMONQueue(
                    self,
                    'FlushRepositoryUpdates',
                    ClientDaemons.DAEMONFlushServiceUpdates,
                    'service_updates_delayed',
                    period=5))

        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 += 'You can right-click popup messages like this to dismiss them.'

            HydrusData.ShowText(message)

        if self._db.IsDBUpdated():

            HydrusData.ShowText('The client has updated to version ' +
                                str(HC.SOFTWARE_VERSION) + '!')
Exemple #3
0
    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:

                            if hashlib.sha256(dlg.GetValue()).digest(
                            ) == self._options['password']:
                                break

                        else:
                            raise HydrusExceptions.PermissionException(
                                'Bad password check')

            self.CallBlockingToWx(wx_code_password)

        self.pub('splash_set_title_text', 'booting gui...')

        def wx_code_gui():

            self._gui = ClientGUI.FrameGUI(self)

            # this is because of some bug in wx C++ that doesn't add these by default
            wx.richtext.RichTextBuffer.AddHandler(
                wx.richtext.RichTextHTMLHandler())
            wx.richtext.RichTextBuffer.AddHandler(
                wx.richtext.RichTextXMLHandler())

            self.ResetIdleTimer()

        self.CallBlockingToWx(wx_code_gui)

        HydrusController.HydrusController.InitView(self)

        self._local_service = None
        self._booru_service = None

        self.RestartServer()
        self.RestartBooru()

        if not self._no_daemons:

            self._daemons.append(
                HydrusThreading.DAEMONWorker(
                    self,
                    'CheckMouseIdle',
                    ClientDaemons.DAEMONCheckMouseIdle,
                    period=10))
            self._daemons.append(
                HydrusThreading.DAEMONWorker(
                    self, 'DownloadFiles', ClientDaemons.DAEMONDownloadFiles,
                    ('notify_new_downloads', 'notify_new_permissions')))
            self._daemons.append(
                HydrusThreading.DAEMONWorker(
                    self, 'SynchroniseAccounts',
                    ClientDaemons.DAEMONSynchroniseAccounts,
                    ('permissions_are_stale', )))
            self._daemons.append(
                HydrusThreading.DAEMONWorker(
                    self, 'SynchroniseSubscriptions',
                    ClientDaemons.DAEMONSynchroniseSubscriptions,
                    ('notify_restart_subs_sync_daemon',
                     'notify_new_subscriptions')))

            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'CheckImportFolders',
                    ClientDaemons.DAEMONCheckImportFolders,
                    ('notify_restart_import_folders_daemon',
                     'notify_new_import_folders'),
                    period=180))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'CheckExportFolders',
                    ClientDaemons.DAEMONCheckExportFolders,
                    ('notify_restart_export_folders_daemon',
                     'notify_new_export_folders'),
                    period=180))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'MaintainTrash',
                    ClientDaemons.DAEMONMaintainTrash,
                    init_wait=60))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'RebalanceClientFiles',
                    ClientDaemons.DAEMONRebalanceClientFiles,
                    period=3600))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'SynchroniseRepositories',
                    ClientDaemons.DAEMONSynchroniseRepositories,
                    ('notify_restart_repo_sync_daemon',
                     'notify_new_permissions'),
                    period=4 * 3600))
            self._daemons.append(
                HydrusThreading.DAEMONBigJobWorker(
                    self,
                    'UPnP',
                    ClientDaemons.DAEMONUPnP, ('notify_new_upnp_mappings', ),
                    init_wait=120,
                    pre_callable_wait=6))

            self._daemons.append(
                HydrusThreading.DAEMONQueue(
                    self,
                    'FlushRepositoryUpdates',
                    ClientDaemons.DAEMONFlushServiceUpdates,
                    'service_updates_delayed',
                    period=5))

        if HydrusGlobals.is_first_start: wx.CallAfter(self._gui.DoFirstStart)
        if HydrusGlobals.is_db_updated:
            wx.CallLater(
                1, HydrusData.ShowText, 'The client has updated to version ' +
                str(HC.SOFTWARE_VERSION) + '!')