def commit(self): x = unicode(self.to_address.text()).strip() parts = x.split('@') if (len(parts) >= 2 and parts[0] and self.send_email_widget.set_email_settings(True)): conf = smtp_prefs() accounts = conf.parse().accounts if not accounts: accounts = {} for y in accounts.values(): y[2] = False accounts[x] = ['AZW, MOBI, TPZ, PRC, AZW1', True, True] conf.set('accounts', accounts)
def commit(self): x = unicode_type(self.to_address.text()).strip() parts = x.split('@') if (len(parts) >= 2 and parts[0] and self.send_email_widget.set_email_settings(True)): conf = smtp_prefs() accounts = conf.parse().accounts if not accounts: accounts = {} for y in accounts.values(): y[2] = False accounts[x] = ['AZW, MOBI, TPZ, PRC, AZW1', True, True] conf.set('accounts', accounts)
def initializePage(self): opts = smtp_prefs().parse() accs = [] has_default = False for x, ac in opts.accounts.iteritems(): default = ac[2] if x.strip().endswith('@kindle.com'): accs.append((x, default)) if default: has_default = True if has_default: accs = [x for x in accs if x[1]] if accs: self.to_address.setText(accs[0]) def x(): t = unicode(self.to_address.text()) if t.strip(): return t.strip() self.send_email_widget.initialize(x)