Пример #1
0
    def _on_bank_ready(self, result):
        """Called when the bank has finished starting.  Alerts the applications to any
    startup arguments that were passed in, which will likely cause them to actually start."""
        if result != True:
            log_msg("Bank failed to start correctly!", 0)
            return result

        #handle the starting arguments:
        Startup.handle_args(ProgramState.STARTING_DIR, sys.argv[1:])
        GlobalEvents.throw_event("startup")

        #if this is the first run, save all the settings files:
        if self.bbApp.isFirstRun:
            for app in [self.bbApp, self.btApp, self.torApp, self.ffApp]:
                if app:
                    app.settings.save()
        self.coreSettings.save()

        #schedule update function:
        def do_update():
            BWHistory.update_all()
            return True

        ProgramState.DO_UPDATES = True
        self.updateEvent = Scheduler.schedule_repeat(
            Globals.INTERVAL_BETWEEN_UPDATES, do_update)
        return result
Пример #2
0
 def __init__(self, conn, args):
     MessageServer.MessageServerHandler.__init__(self, conn, args)
     self.clientConn.sendMessage("SUCCESS")
     args = args.split("\n")
     startingDir = args.pop(0)
     decodedStartingDir = System.decode_from_filesystem(startingDir)
     Startup.handle_args(decodedStartingDir, args)
Пример #3
0
 def _on_bank_ready(self, result):
   """Called when the bank has finished starting.  Alerts the applications to any
   startup arguments that were passed in, which will likely cause them to actually start."""
   if result != True:
     log_msg("Bank failed to start correctly!", 0)
     return result
     
   #handle the starting arguments:
   Startup.handle_args(ProgramState.STARTING_DIR, sys.argv[1:])
   GlobalEvents.throw_event("startup")
   
   #if this is the first run, save all the settings files:
   if self.bbApp.isFirstRun:
     for app in [self.bbApp, self.btApp, self.torApp, self.ffApp]:
       if app:
         app.settings.save()
   self.coreSettings.save()
    
   #schedule update function:
   def do_update():
     BWHistory.update_all()
     return True
   ProgramState.DO_UPDATES = True
   self.updateEvent = Scheduler.schedule_repeat(Globals.INTERVAL_BETWEEN_UPDATES, do_update)
   return result
Пример #4
0
 def __init__(self, conn, args):
   MessageServer.MessageServerHandler.__init__(self, conn, args)
   self.clientConn.sendMessage("SUCCESS")
   args = args.split("\n")
   startingDir = args.pop(0)
   decodedStartingDir = System.decode_from_filesystem(startingDir)
   Startup.handle_args(decodedStartingDir, args)
   
Пример #5
0
#!/usr/bin/python
#Copyright 2008-2009 InnomiNet
"""Call this script with the appropriate arguments to start BitBlinder"""
      
if __name__ == '__main__':
  #NOTE:  M2Crypto must be imported first because it causes crashes if imported after OpenSSL (which we don't use, but Twisted tries to import)
  import M2Crypto
  from core import Logging
  from common import Globals
  Globals.logger = Logging.Logger()
  try:
    #run startup code.  This will exit if we're not supposed to be starting BitBlinder 
    #(for example, when passing arguments to an existing instance)
    from core import Startup
    Startup.startup()

    #if we're still running, it's time to start the main class.
    from Applications import MainLoop
    mainApp = MainLoop.MainLoop()
    mainApp.start()
    #this call blocks and calls gtk.main or reactor.run as appropriate
    mainApp.main()
    #do any necessary cleanup before we exit
    mainApp.cleanup()
  #this will prompt the user in an appropriate fashion for their OS if they want to submit an error report
  #most exceptions will be caught by the main loop instead
  except Exception, error:
    Globals.logger.report_startup_error(error)
    
  import gc
  gc.collect()