Esempio n. 1
0
    def Run(self):

        HydrusData.RecordRunningStart(self.db_dir, 'server')

        HydrusData.Print(u'Initialising db\u2026')

        self.InitModel()

        HydrusData.Print(u'Initialising daemons and services\u2026')

        self.InitView()

        HydrusData.Print('Server is running. Press Ctrl+C to quit.')

        try:

            while not self._model_shutdown and not self._shutdown:

                time.sleep(1)

        except KeyboardInterrupt:

            HydrusData.Print(u'Received a keyboard interrupt\u2026')

        HydrusData.Print(u'Shutting down controller\u2026')

        self.Exit()
Esempio n. 2
0
    def THREADBootEverything(self):

        try:

            self.CheckAlreadyRunning()

            self._last_shutdown_was_bad = HydrusData.LastShutdownWasBad(
                self.db_dir, 'client')

            HydrusData.RecordRunningStart(self.db_dir, 'client')

            self.InitModel()

            self.InitView()

            self._is_booted = True

        except HydrusExceptions.PermissionException as e:

            HydrusData.Print(e)

            HG.emergency_exit = True

            self.Exit()

        except Exception as e:

            text = 'A serious error occurred while trying to start the program. The error will be shown next in a window. More information may have been written to client.log.'

            HydrusData.DebugPrint(
                'If the db crashed, another error may be written just above ^.'
            )
            HydrusData.DebugPrint(text)

            HydrusData.DebugPrint(traceback.format_exc())

            wx.CallAfter(wx.MessageBox, traceback.format_exc())
            wx.CallAfter(wx.MessageBox, text)

            HG.emergency_exit = True

            self.Exit()

        finally:

            self._DestroySplash()
Esempio n. 3
0
    def THREADBootEverything(self):

        try:

            self.CheckAlreadyRunning()

            self._last_shutdown_was_bad = HydrusData.LastShutdownWasBad(
                HC.DB_DIR, 'client')

            HydrusData.RecordRunningStart(HC.DB_DIR, 'client')

            self.InitModel()

            self.InitView()

        except HydrusExceptions.PermissionException as e:

            HydrusData.Print(e)

            HydrusGlobals.emergency_exit = True

            self.Exit()

        except Exception as e:

            text = 'A serious error occured while trying to start the program. Its traceback will be shown next. It should have also been written to client.log.'

            HydrusData.DebugPrint(text)

            traceback.print_exc()

            wx.CallAfter(wx.MessageBox, traceback.format_exc())
            wx.CallAfter(wx.MessageBox, text)

            HydrusGlobals.emergency_exit = True

            self.Exit()

        finally:

            self.pub('splash_destroy')
Esempio n. 4
0
 def Run( self ):
     
     HydrusData.RecordRunningStart( self._db_dir, 'server' )
     
     HydrusData.Print( u'Initialising db\u2026' )
     
     self.InitModel()
     
     HydrusData.Print( u'Initialising daemons and services\u2026' )
     
     self.InitView()
     
     HydrusData.Print( 'Server is running. Press Ctrl+C to quit.' )
     
     interrupt_received = False
     
     while not self._model_shutdown:
         
         try:
             
             time.sleep( 1 )
             
         except KeyboardInterrupt:
             
             if not interrupt_received:
                 
                 interrupt_received = True
                 
                 HydrusData.Print( u'Received a keyboard interrupt\u2026' )
                 
                 def do_it():
                     
                     self.Exit()
                     
                 
                 self.CallToThread( do_it )
                 
             
         
     
     HydrusData.Print( u'Shutting down controller\u2026' )