コード例 #1
0
    def _load_settings(self):
        """Load global and core settings files.  Deals with old format for storing settings"""

        #load a global config that said whether to store the last user that logged in (and his password)
        self.globalSettings = GlobalSettings.load()
        #always save, so the user can more easily edit the file for starting up from the console
        self.globalSettings.save()

        #does a settings file already exist?
        settingsFile = os.path.join(Globals.USER_DATA_DIR,
                                    CoreSettings.CoreSettings.defaultFile)
        if not Files.file_exists(settingsFile):
            #if not, make the folder
            if not Files.file_exists(Globals.USER_DATA_DIR):
                os.makedirs(Globals.USER_DATA_DIR)
            #and check that this isnt an old installation (we used to store settings on a
            #per username basis, which turned out to be a stupid idea).  If that data exists,
            #copy it to the new location.
            if len(self.globalSettings.username) > 0:
                oldSettingsFilePath = os.path.join(
                    Globals.USER_DATA_DIR, self.globalSettings.username,
                    CoreSettings.CoreSettings.defaultFile)
                if os.path.exists(oldSettingsFilePath):
                    oldFolder = os.path.join(Globals.USER_DATA_DIR,
                                             self.globalSettings.username)
                    newFolder = Globals.USER_DATA_DIR
                    Files.recursive_copy_folder(oldFolder, newFolder)

        #load the core settings:
        CoreSettings.start()
        self.coreSettings = CoreSettings.get()
        self.coreSettings.load(settingsFile)
        self.coreSettings.fileName = settingsFile
コード例 #2
0
ファイル: MainLoop.py プロジェクト: clawplach/BitBlinder
 def _load_settings(self):
   """Load global and core settings files.  Deals with old format for storing settings"""
   
   #load a global config that said whether to store the last user that logged in (and his password)
   self.globalSettings = GlobalSettings.load()
   #always save, so the user can more easily edit the file for starting up from the console
   self.globalSettings.save()
   
   #does a settings file already exist?
   settingsFile = os.path.join(Globals.USER_DATA_DIR, CoreSettings.CoreSettings.defaultFile)
   if not Files.file_exists(settingsFile):
     #if not, make the folder
     if not Files.file_exists(Globals.USER_DATA_DIR):
       os.makedirs(Globals.USER_DATA_DIR)
     #and check that this isnt an old installation (we used to store settings on a 
     #per username basis, which turned out to be a stupid idea).  If that data exists,
     #copy it to the new location.
     if len(self.globalSettings.username) > 0:
       oldSettingsFilePath = os.path.join(Globals.USER_DATA_DIR, self.globalSettings.username, CoreSettings.CoreSettings.defaultFile)
       if os.path.exists(oldSettingsFilePath):
         oldFolder = os.path.join(Globals.USER_DATA_DIR, self.globalSettings.username)
         newFolder = Globals.USER_DATA_DIR
         Files.recursive_copy_folder(oldFolder, newFolder)
       
   #load the core settings:
   CoreSettings.start()
   self.coreSettings = CoreSettings.get()
   self.coreSettings.load(settingsFile)
   self.coreSettings.fileName = settingsFile
コード例 #3
0
    def do_verification_prompt(self, bankApp):
        #load a global config that said whether to store the last user that logged in (and his password)
        settings = GlobalSettings.load()

        #just directly login:
        self.username = str(settings.username)
        self.password = str(settings.password)
        self.savePass = settings.save_password
        while not self.username or not self.password:
            self.username = str(raw_input('Enter your username: '******'Enter your password: '******'Should save password? (yes/no) '))
            self.savePass = shouldSave.lower() in ("yes", "y")

        #just directly login:
        Bank.get().login(self.username, self.password)
コード例 #4
0
ファイル: Controller.py プロジェクト: clawplach/BitBlinder
 def do_verification_prompt(self, bankApp):
   #load a global config that said whether to store the last user that logged in (and his password)
   settings = GlobalSettings.load()
     
   #just directly login:
   self.username = str(settings.username)
   self.password = str(settings.password)
   self.savePass = settings.save_password
   while not self.username or not self.password:
     self.username = str(raw_input('Enter your username: '******'Enter your password: '******'Should save password? (yes/no) '))
     self.savePass = shouldSave.lower() in ("yes", "y")
     
   #just directly login:
   Bank.get().login(self.username, self.password)
コード例 #5
0
    def __init__(self, bankApp):
        ListenerMixin.ListenerMixin.__init__(self)
        self.username = None
        self.password = None

        self._start_listening_for_event("login_success", bankApp,
                                        self.on_login_success)
        self._start_listening_for_event("login_failure", bankApp,
                                        self.on_login_failure)

        dia = gtk.Dialog("Login", None, 0, None)

        dia.connect("destroy", self.destroy_cb)
        #    dia.connect("expose_event", self.expose_cb)

        self.started = False
        self.succeeded = False

        self.loginButton = dia.add_button("Login", gtk.RESPONSE_OK)
        self.quitButton = dia.add_button("Quit", gtk.RESPONSE_CANCEL)

        #username field
        self.usernameLabel = gtk.Label("Username")
        self.nameEntry = gtk.Entry()
        self.nameEntry.set_max_length(50)
        self.nameEntry.connect("activate", self.enter_callback)

        #password field
        self.pwLabel = gtk.Label("Password")
        self.pwEntry = gtk.Entry()
        self.pwEntry.set_max_length(50)
        #so people cant see our password:
        self.pwEntry.set_visibility(False)
        self.pwEntry.connect("activate", self.enter_callback)

        resetPasswordLink = GTKUtils.make_html_link(
            "Forgot your password?",
            "%s/accounts/resetPassword/" % (ProgramState.Conf.BASE_HTTP))
        makeAccountLink = GTKUtils.make_html_link(
            "Need an account?",
            "%s/accounts/register/" % (ProgramState.Conf.BASE_HTTP))

        #put them in a nice little table
        table = gtk.Table(4, 2, True)
        table.attach(self.usernameLabel, 0, 1, 0, 1)
        table.attach(self.nameEntry, 1, 2, 0, 1)
        table.attach(makeAccountLink, 1, 2, 1, 2)
        table.attach(self.pwLabel, 0, 1, 2, 3)
        table.attach(self.pwEntry, 1, 2, 2, 3)
        table.attach(resetPasswordLink, 1, 2, 3, 4)

        self.savePassCheck = gtk.CheckButton("Remember Username/Password")

        #A text entry telling the user what to do:
        self.label = WrapLabel.WrapLabel()
        self.label.set_markup(
            "<span weight='bold'>Use your account name and password from the BitBlinder website!</span>"
        )
        align = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1.0, yscale=0.0)
        align.add(self.label)
        align.set_padding(10, 10, 5, 5)

        dia.vbox.pack_start(GTKUtils.add_frame(align), True, True, 10)
        dia.vbox.pack_start(table, True, True, 0)
        dia.vbox.pack_start(self.savePassCheck, True, True, 10)

        #load a global config that said whether to store the last user that logged in (and his password)
        settings = GlobalSettings.load()

        self.nameEntry.set_text(settings.username)
        self.pwEntry.set_text(settings.password)
        self.savePassCheck.set_active(settings.save_password)

        #connect the handler:
        dia.connect("response", self.on_response)
        self.dia = dia
コード例 #6
0
ファイル: LoginDialog.py プロジェクト: clawplach/BitBlinder
  def __init__(self, bankApp):
    ListenerMixin.ListenerMixin.__init__(self)
    self.username = None
    self.password = None
    
    self._start_listening_for_event("login_success", bankApp, self.on_login_success)
    self._start_listening_for_event("login_failure", bankApp, self.on_login_failure)

    dia = gtk.Dialog("Login", None, 0, None)

    dia.connect("destroy", self.destroy_cb)
#    dia.connect("expose_event", self.expose_cb)
    
    self.started = False
    self.succeeded = False
    
    self.loginButton = dia.add_button("Login", gtk.RESPONSE_OK)
    self.quitButton = dia.add_button("Quit", gtk.RESPONSE_CANCEL)
    
    #username field
    self.usernameLabel = gtk.Label("Username")
    self.nameEntry = gtk.Entry()
    self.nameEntry.set_max_length(50)
    self.nameEntry.connect("activate", self.enter_callback)
    
    #password field
    self.pwLabel = gtk.Label("Password")
    self.pwEntry = gtk.Entry()
    self.pwEntry.set_max_length(50)
    #so people cant see our password:
    self.pwEntry.set_visibility(False)
    self.pwEntry.connect("activate", self.enter_callback)
    
    resetPasswordLink = GTKUtils.make_html_link("Forgot your password?", "%s/accounts/resetPassword/" % (ProgramState.Conf.BASE_HTTP))
    makeAccountLink = GTKUtils.make_html_link("Need an account?", "%s/accounts/register/" % (ProgramState.Conf.BASE_HTTP))
    
    #put them in a nice little table
    table = gtk.Table(4, 2, True)
    table.attach(self.usernameLabel, 0, 1, 0, 1)
    table.attach(self.nameEntry, 1, 2, 0, 1)
    table.attach(makeAccountLink, 1, 2, 1, 2)
    table.attach(self.pwLabel, 0, 1, 2, 3)
    table.attach(self.pwEntry, 1, 2, 2, 3)
    table.attach(resetPasswordLink, 1, 2, 3, 4)
    
    self.savePassCheck = gtk.CheckButton("Remember Username/Password")
    
    #A text entry telling the user what to do:
    self.label = WrapLabel.WrapLabel()
    self.label.set_markup("<span weight='bold'>Use your account name and password from the BitBlinder website!</span>")
    align = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1.0, yscale=0.0)
    align.add(self.label)
    align.set_padding(10, 10, 5, 5)

    dia.vbox.pack_start(GTKUtils.add_frame(align), True, True, 10)
    dia.vbox.pack_start(table, True, True, 0)
    dia.vbox.pack_start(self.savePassCheck, True, True, 10)
    
    #load a global config that said whether to store the last user that logged in (and his password)
    settings = GlobalSettings.load()
    
    self.nameEntry.set_text(settings.username)
    self.pwEntry.set_text(settings.password)
    self.savePassCheck.set_active(settings.save_password)

    #connect the handler:
    dia.connect("response", self.on_response)
    self.dia = dia