Example #1
0
    def __on_toggled_cb(self, bool):
        email = str(self.ui.comboAccount.currentText())
        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, email)

        sender = self.sender()
        #just like wlm :)
        if sender == self.ui.checkRememberMe:
            accv.save = bool
            if not bool:
                self.ui.checkRememberPass.setChecked(False)
                self.ui.checkSignInAuto.setChecked(False)
        elif sender == self.ui.checkRememberPass:
            accv.save_password = bool
            if bool:
                self.ui.checkRememberMe.setChecked(True)
            else:
                self.ui.checkSignInAuto.setChecked(False)
        elif sender == self.ui.checkSignInAuto:
            accv.autologin = bool
            if bool:
                self.ui.checkRememberMe.setChecked(True)
                self.ui.checkRememberPass.setChecked(True)
Example #2
0
File: login.py Project: amsn/amsn2
    def __on_toggled_cb(self, bool):
        email = str(self.ui.comboAccount.currentText())
        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, email)

        sender = self.sender()
        # just like wlm :)
        if sender == self.ui.checkRememberMe:
            accv.save = bool
            if not bool:
                self.ui.checkRememberPass.setChecked(False)
                self.ui.checkSignInAuto.setChecked(False)
        elif sender == self.ui.checkRememberPass:
            accv.save_password = bool
            if bool:
                self.ui.checkRememberMe.setChecked(True)
            else:
                self.ui.checkSignInAuto.setChecked(False)
        elif sender == self.ui.checkSignInAuto:
            accv.autologin = bool
            if bool:
                self.ui.checkRememberMe.setChecked(True)
                self.ui.checkRememberPass.setChecked(True)
    def load_account(self, email):
        accview = None
        self.create_account_file_tree(email)
        accpath = os.path.join(self.account_dir, "account.xml")
        accfile = file(accpath, "r")
        root_tree = ElementTree(file=accfile)
        accfile.close()
        account = root_tree.getroot()
        if account.tag == "aMSNAccount":
            #email
            emailElmt = account.find("email")
            if emailElmt is None:
                return None
            accview = AccountView(self._core, emailElmt.text)
            #nick
            nickElmt = account.find("nick")
            if nickElmt is None:
                return None
            if nickElmt.text:
                accview.nick.append_text(nickElmt.text)
            #TODO: parse...
            #psm
            psmElmt = account.find("psm")
            if psmElmt is None:
                return None
            if psmElmt.text:
                accview.psm.append_text(psmElmt.text)
            #presence
            presenceElmt = account.find("presence")
            if presenceElmt is None:
                return None
            accview.presence = presenceElmt.text
            #password
            passwordElmt = account.find("password")
            if passwordElmt is None:
                accview.password = None
            else:
                accview.password = passwordElmt.text
            #save_password
            savePassElmt = account.find("save_password")
            if savePassElmt.text == "False":
                accview.save_password = False
            else:
                accview.save_password = True
            #autoconnect
            saveAutoConnect = account.find("autoconnect")
            if saveAutoConnect.text == "False":
                accview.autologin = False
            else:
                accview.autologin = True
            #TODO: use backend & all
            #dp
            dpElmt = account.find("dp")
            #TODO

            #TODO: preferred_ui ?

            accview.save = True

        return accview
Example #4
0
    def __init__(self, core, options):
        self._core = core
        self.reload()

        if options.account is not None:
            pv = [p for p in self.accountviews if p.email == options.account]
            if pv:
                pv = pv[0]
                self.accountviews.remove(pv)
            else:
                pv = AccountView(core, options.account)
                pv.password = options.password
            self.accountviews.insert(0, pv)
Example #5
0
    def __on_toggled_cb(self, source):

        email = self.user.get_active_text()
        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, email)

        if source is self.rememberMe:
            accv.save = source.get_active()
            self.rememberPass.set_sensitive(source.get_active())
            self.autoLogin.set_sensitive(source.get_active())
        elif source is self.rememberPass:
            accv.save_password = source.get_active()
            self.autoLogin.set_sensitive(source.get_active())
        elif source is self.autoLogin:
            accv.autologin = source.get_active()
Example #6
0
    def __on_toggled_cb(self, source):

        email = self.user.get_active_text()
        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, email)

        if source is self.rememberMe:
            accv.save = source.get_active()
            self.rememberPass.set_sensitive(source.get_active())
            self.autoLogin.set_sensitive(source.get_active())
        elif source is self.rememberPass:
            accv.save_password = source.get_active()
            self.autoLogin.set_sensitive(source.get_active())
        elif source is self.autoLogin:
            accv.autologin = source.get_active()
    def __init__(self, core, options):
        """
        @type core: L{amsn2.core.amsn.aMSNCore}
        @type options: Values
        """
        self._core = core
        self.reload()

        if options.account is not None:
            pv = [p for p in self.accountviews if p.email == options.account]
            if pv:
                pv = pv[0]
                self.accountviews.remove(pv)
            else:
                pv = AccountView(core, options.account)
                pv.password = options.password
            self.accountviews.insert(0, pv)
Example #8
0
    def __get_account(self):
        if self.user.get_active_text() == "":
            self.user.grab_focus()
            return
        elif self.password.get_text() == "":
            self.password.grab_focus()
            return

        email = self.user.get_active_text()
        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, email)

        accv.password = self.password.get_text()
        iter = self.statusCombo.get_active_iter()
        model = self.statusCombo.get_model()
        status = model.get_value(iter, 2)
        accv.presence = status

        accv.save = self.rememberMe.get_active()
        accv.save_password = self.rememberPass.get_active()
        accv.autologin = self.autoLogin.get_active()

        return accv
Example #9
0
 def set_accounts(self, account_views):
     self.accounts = account_views
     #TODO: add autologin stuff, account selection
     if len(self.accounts) == 0:
         a = AccountView(self._amsn_core, "")
         self.switch_to_profile(a)
     for a in self.accounts:
         self.switch_to_profile(a)
         break
Example #10
0
    def __get_account(self):
        if self.user.get_active_text() == "":
            self.user.grab_focus()
            return
        elif self.password.get_text() == "":
            self.password.grab_focus()
            return

        email = self.user.get_active_text()
        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, email)

        accv.password = self.password.get_text()
        iter = self.statusCombo.get_active_iter()
        model = self.statusCombo.get_model()
        status = model.get_value(iter, 2)
        accv.presence = status

        accv.save = self.rememberMe.get_active()
        accv.save_password = self.rememberPass.get_active()
        accv.autologin = self.autoLogin.get_active()

        return accv
Example #11
0
    def __switch_to_account(self, email):

        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, email)

        self.ui.comboAccount.setEditText(accv.email)

        if accv.password:
            self.ui.linePassword.clear()
            self.ui.linePassword.insert(accv.password)

        self.ui.checkRememberMe.setChecked(accv.save)
        self.ui.checkRememberPass.setChecked(accv.save_password)
        self.ui.checkSignInAuto.setChecked(accv.autologin)
Example #12
0
    def __switch_to_account(self, email):
        logger.info("Switching to account %s", email)

        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, email)

        self.user.get_children()[0].set_text(accv.email)
        if accv.password:
            self.password.set_text(accv.password)

        self.statusCombo.set_active(self.status_values[accv.presence])

        self.rememberMe.set_active(accv.save)
        self.rememberPass.set_active(accv.save_password)
        self.autoLogin.set_active(accv.autologin)
        self.accountview = accv
Example #13
0
    def __login_clicked(self):
        email = str(self.ui.comboAccount.currentText())
        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, str(email))

        accv.password = self.ui.linePassword.text().toLatin1().data()
        accv.presence = str(
            self.ui.comboStatus.itemData(
                self.ui.comboStatus.currentIndex()).toString())

        accv.save = self.ui.checkRememberMe.isChecked()
        accv.save_password = self.ui.checkRememberPass.isChecked()
        accv.autologin = self.ui.checkSignInAuto.isChecked()
        print accv
        self._amsn_core.signin_to_account(self, accv)
Example #14
0
File: login.py Project: amsn/amsn2
    def __login_clicked(self):
        email = str(self.ui.comboAccount.currentText())
        accv = self._ui_manager.get_accountview_from_email(email)

        if accv is None:
            accv = AccountView(self._amsn_core, str(email))

        accv.password = self.ui.linePassword.text().toLatin1().data()
        accv.presence = str(self.ui.comboStatus.itemData(self.ui.comboStatus.currentIndex()).toString())

        accv.save = self.ui.checkRememberMe.isChecked()
        accv.save_password = self.ui.checkRememberPass.isChecked()
        accv.autologin = self.ui.checkSignInAuto.isChecked()
        print accv
        self._amsn_core.signin_to_account(self, accv)
    def load_account(self, email):
        """
        @type email: str
        """
        accview = None
        self.create_account_file_tree(email)
        accpath = os.path.join(self.account_dir, "account.xml")
        accfile = file(accpath, "r")
        root_tree = ElementTree(file=accfile)
        accfile.close()
        account = root_tree.getroot()
        if account.tag == "aMSNAccount":
            #email
            emailElmt = account.find("email")
            if emailElmt is None:
                return None
            accview = AccountView(self._core, emailElmt.text)
            #nick
            nickElmt = account.find("nick")
            if nickElmt is None:
                return None
            if nickElmt.text:
                accview.nick.append_text(nickElmt.text)
            #TODO: parse...
            #psm
            psmElmt = account.find("psm")
            if psmElmt is None:
                return None
            if psmElmt.text:
                accview.psm.append_text(psmElmt.text)
            #presence
            presenceElmt = account.find("presence")
            if presenceElmt is None:
                return None
            accview.presence = presenceElmt.text
            #password
            passwordElmt = account.find("password")
            if passwordElmt is None:
                accview.password = None
            else:
                accview.password = passwordElmt.text
            #save_password
            savePassElmt = account.find("save_password")
            if savePassElmt.text == "False":
                accview.save_password = False
            else:
                accview.save_password = True
            #autoconnect
            saveAutoConnect = account.find("autoconnect")
            if saveAutoConnect.text == "False":
                accview.autologin = False
            else:
                accview.autologin = True
            #TODO: use backend & all
            #dp
            dpElmt = account.find("dp")
            #TODO

            #TODO: preferred_ui ?

            accview.save = True

        return accview