Fix commas doubled when editing formats list in email preferences

This commit is contained in:
Kovid Goyal 2017-05-20 13:15:44 +05:30
parent 9d55e3aa9e
commit b15521bd74
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -109,7 +109,7 @@ class EmailAccounts(QAbstractTableModel): # {{{
if col == 0: if col == 0:
return (account) return (account)
if col == 1: if col == 1:
return (self.accounts[account][0]) return ', '.join(x.strip() for x in (self.accounts[account][0] or '').split(','))
if col == 2: if col == 2:
return (self.subjects.get(account, '')) return (self.subjects.get(account, ''))
if col == 4: if col == 4:
@ -148,7 +148,7 @@ class EmailAccounts(QAbstractTableModel): # {{{
if aval: if aval:
self.tags[account] = aval self.tags[account] = aval
elif col == 1: elif col == 1:
self.accounts[account][0] = re.sub(r'\s+', ',', unicode(value or '').upper()) self.accounts[account][0] = re.sub(',+', ',', re.sub(r'\s+', ',', unicode(value or '').upper()))
elif col == 0: elif col == 0:
na = unicode(value or '') na = unicode(value or '')
from email.utils import parseaddr from email.utils import parseaddr
@ -284,6 +284,6 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
if __name__ == '__main__': if __name__ == '__main__':
from PyQt5.Qt import QApplication from calibre.gui2 import Application
app = QApplication([]) app = Application([])
test_widget('Sharing', 'Email') test_widget('Sharing', 'Email')