Esempio n. 1
0
 def __init__(self, q_in, q_out, recovered=False):
     
     #Instantiate the logger
     loggerObj = Logger(self.__class__.__name__)
     self.logger = loggerObj.getLoggerInstance()
     
     self.logger.info("Initializing the Gado System...")
     
     #Load up both queues
     self.q_in = q_in
     self.q_out = q_out
     
     #Grab the settings from gado.conf (If it exists) and place them into
     #a local object so that they can be used here
     self.load_settings()
     
     #If there are no settings (because there is no gado.conf)
     if not self.s:
         #Grab the default settings and load them into a newly created gado.conf
         export_settings(**default_settings())
         
         #Load those default settings to a local object
         self.load_settings()
         
         #Because there is no gado.conf, we're going to need to launch
         #the configuration wizard so that the user can enter their
         #personal settings
         add_to_queue(self.q_out, messages.LAUNCH_WIZARD)
         
         print 'gado_sys\tasked to launch the wizard'
     
     #Even if we do have a gado.conf file, the wizard has never been run
     #so it needs to get launched for the user's personal preferences
     elif 'wizard_run' in self.s and int(self.s['wizard_run']) == 0:
         add_to_queue(self.q_out, messages.LAUNCH_WIZARD)
         print 'gado_sys\tasked to launch the wizard2'
     
     #If this is the first time the logic thread has been run,
     #tell the gui thread that the system is ready for interactions
     else:
         print 'gado_sys\tnot asked for a wizard'
         if not recovered: add_to_queue(self.q_out, messages.READY)
     
     #Get an instance of the database and the database interface
     self.db = DBFactory(**self.s).get_db()
     self.dbi = DBInterface(self.db)
     
     #Init local vars
     self.selected_set = None
     self.started = False