def awakeFromNib(self):
     NSLog("Check if we already have a conf file.")
     admin_directory = os.path.join(os.environ["HOME"], ".safedepositbox")
     config_filepath = os.path.join(admin_directory, "safedepositbox.conf")
     # Check if configuration file exists and either create it with user data
     # or launch the statusbar.
     if not os.path.exists(config_filepath):
         wc = self.initWithWindowNibName_("MainMenu")
         wc.showWindow_(self)
     else:
         SDBStatusBar.alloc().doDisplay(self)
    def saveClose_(self, sender):
        # Logic for controlling the setup menu.
        values = { 'firstName' : self.firstName.stringValue(),
                   'lastName': self.lastName.stringValue(),
                   'userEmailAddress' : self.userEmailAddress.stringValue(),
                   'userPassword' : self.userPassword.stringValue(),
                   'verifyPassword' : self.verifyPassword.stringValue(),
                   'awsAccessKey' : self.awsAccessKey.stringValue(),
                   'awsSecretKey' : self.awsSecretKey.stringValue(),
                   'computerName' : self.computerName.stringValue(),
                   'sdbDirectory' : os.path.join(os.environ["HOME"],
                                                 "SafeDepositBox"),
                    }
                           
        rcp = ConfigParser.RawConfigParser()
        section = "sdb"
        rcp.add_section(section)

        bClose = True
        for key in values:
            val = values.get(key)
            if not val:
                bClose = False
            rcp.set(section, key, val)

        if (bClose and 
            (values.get('userPassword') != values.get('verifyPassword'))):
            # Tell user that their passwords don't match (show highlighted box?)
            bClose = False

        if bClose:
            # Create Admin Directory
            admin_directory = os.path.join(os.environ["HOME"], 
                                           ".safedepositbox")
            if not os.path.exists(admin_directory):
                os.mkdir(admin_directory)
            elif not os.path.isdir(admin_directory):
                os.remove(admin_directory)
                os.mkdir(admIn_directory)
                
            config_filepath = os.path.join(admin_directory, 
                                           "safedepositbox.conf")                                           
            with open(config_filepath,'w') as fh:
                rcp.write(fh)
            NSLog("Wrote configuration file!")

            # Show status bar now that we have initialized everything.
            SDBStatusBar.alloc().doDisplay(self)

            self.close()