def checkHasNormalAddress(): for address in account.getSortedAccounts(): acct = account.accountClass(address) if acct.type == AccountMixin.NORMAL and shared.safeConfigGetBoolean( address, 'enabled'): return address return False
def __init__(self, parent, config=None, account=None): super(EmailGatewayDialog, self).__init__(parent) widgets.load('emailgateway.ui', self) self.parent = parent self.config = config if account: self.acct = account self.setWindowTitle( _translate("EmailGatewayDialog", "Registration failed:")) self.label.setText( _translate( "EmailGatewayDialog", "The requested email address is not available," " please try a new one.")) self.radioButtonRegister.hide() self.radioButtonStatus.hide() self.radioButtonSettings.hide() self.radioButtonUnregister.hide() else: address = parent.getCurrentAccount() self.acct = accountClass(address) try: label = config.get(address, 'label') except AttributeError: pass else: if "@" in label: self.lineEditEmail.setText(label) if isinstance(self.acct, GatewayAccount): self.radioButtonUnregister.setEnabled(True) self.radioButtonStatus.setEnabled(True) self.radioButtonStatus.setChecked(True) self.radioButtonSettings.setEnabled(True) self.lineEditEmail.setEnabled(False) else: self.acct = MailchuckAccount(address) self.lineEditEmail.setFocus() QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
def __init__(self, parent, config=None, account=None): super(EmailGatewayDialog, self).__init__(parent) widgets.load('emailgateway.ui', self) self.parent = parent self.config = config if account: self.acct = account self.setWindowTitle(_translate( "EmailGatewayDialog", "Registration failed:")) self.label.setText(_translate( "EmailGatewayDialog", "The requested email address is not available," " please try a new one." )) self.radioButtonRegister.hide() self.radioButtonStatus.hide() self.radioButtonSettings.hide() self.radioButtonUnregister.hide() else: address = parent.getCurrentAccount() self.acct = accountClass(address) try: label = config.get(address, 'label') except AttributeError: pass else: if "@" in label: self.lineEditEmail.setText(label) if isinstance(self.acct, GatewayAccount): self.radioButtonUnregister.setEnabled(True) self.radioButtonStatus.setEnabled(True) self.radioButtonStatus.setChecked(True) self.radioButtonSettings.setEnabled(True) self.lineEditEmail.setEnabled(False) else: self.acct = MailchuckAccount(address) self.lineEditEmail.setFocus() QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
def checkHasNormalAddress(): for address in account.getSortedAccounts(): acct = account.accountClass(address) if acct.type == AccountMixin.NORMAL and BMConfigParser().safeGetBoolean(address, 'enabled'): return address return False