Account listing and sorting
- account listing and sorting has now a common function to reuse - combobox send from is now sorted, Fixes #59
This commit is contained in:
parent
afeadcf8d2
commit
d51431b1dc
|
@ -467,9 +467,7 @@ class MyForm(QtGui.QMainWindow):
|
|||
db = {}
|
||||
enabled = {}
|
||||
|
||||
for toAddress in shared.config.sections():
|
||||
if toAddress == 'bitmessagesettings':
|
||||
continue
|
||||
for toAddress in getSortedAccounts():
|
||||
isEnabled = shared.config.getboolean(
|
||||
toAddress, 'enabled')
|
||||
isChan = shared.safeConfigGetBoolean(
|
||||
|
@ -553,9 +551,7 @@ class MyForm(QtGui.QMainWindow):
|
|||
|
||||
# Ask the user if we may delete their old version 1 addresses if they
|
||||
# have any.
|
||||
configSections = shared.config.sections()
|
||||
for addressInKeysFile in configSections:
|
||||
if addressInKeysFile != 'bitmessagesettings':
|
||||
for addressInKeysFile in getSortedAccounts():
|
||||
status, addressVersionNumber, streamNumber, hash = decodeAddress(
|
||||
addressInKeysFile)
|
||||
if addressVersionNumber == 1:
|
||||
|
@ -2184,15 +2180,14 @@ class MyForm(QtGui.QMainWindow):
|
|||
|
||||
def rerenderComboBoxSendFrom(self):
|
||||
self.ui.comboBoxSendFrom.clear()
|
||||
configSections = shared.config.sections()
|
||||
for addressInKeysFile in configSections:
|
||||
if addressInKeysFile != 'bitmessagesettings':
|
||||
for addressInKeysFile in getSortedAccounts():
|
||||
isEnabled = shared.config.getboolean(
|
||||
addressInKeysFile, 'enabled') # I realize that this is poor programming practice but I don't care. It's easier for others to read.
|
||||
isMaillinglist = shared.safeConfigGetBoolean(addressInKeysFile, 'mailinglist')
|
||||
if isEnabled and not isMaillinglist:
|
||||
self.ui.comboBoxSendFrom.insertItem(0, avatarize(addressInKeysFile), unicode(shared.config.get(
|
||||
self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), unicode(shared.config.get(
|
||||
addressInKeysFile, 'label'), 'utf-8'), addressInKeysFile)
|
||||
# self.ui.comboBoxSendFrom.model().sort(1, Qt.AscendingOrder)
|
||||
self.ui.comboBoxSendFrom.insertItem(0, '', '')
|
||||
if(self.ui.comboBoxSendFrom.count() == 2):
|
||||
self.ui.comboBoxSendFrom.setCurrentIndex(1)
|
||||
|
@ -2201,14 +2196,12 @@ class MyForm(QtGui.QMainWindow):
|
|||
|
||||
def rerenderComboBoxSendFromBroadcast(self):
|
||||
self.ui.comboBoxSendFromBroadcast.clear()
|
||||
configSections = shared.config.sections()
|
||||
for addressInKeysFile in configSections:
|
||||
if addressInKeysFile != 'bitmessagesettings':
|
||||
for addressInKeysFile in getSortedAccounts():
|
||||
isEnabled = shared.config.getboolean(
|
||||
addressInKeysFile, 'enabled') # I realize that this is poor programming practice but I don't care. It's easier for others to read.
|
||||
isMaillinglist = shared.safeConfigGetBoolean(addressInKeysFile, 'mailinglist')
|
||||
if isEnabled and isMaillinglist:
|
||||
self.ui.comboBoxSendFromBroadcast.insertItem(0, avatarize(addressInKeysFile), unicode(shared.config.get(
|
||||
self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), unicode(shared.config.get(
|
||||
addressInKeysFile, 'label'), 'utf-8'), addressInKeysFile)
|
||||
self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '')
|
||||
if(self.ui.comboBoxSendFromBroadcast.count() == 2):
|
||||
|
@ -2713,10 +2706,7 @@ class MyForm(QtGui.QMainWindow):
|
|||
|
||||
def click_NewAddressDialog(self):
|
||||
addresses = []
|
||||
configSections = shared.config.sections()
|
||||
for addressInKeysFile in configSections:
|
||||
if addressInKeysFile == 'bitmessagesettings':
|
||||
continue
|
||||
for addressInKeysFile in getSortedAccounts():
|
||||
addresses.append(addressInKeysFile)
|
||||
# self.dialog = Ui_NewAddressWizard(addresses)
|
||||
# self.dialog.exec_()
|
||||
|
@ -4056,10 +4046,7 @@ class NewAddressDialog(QtGui.QDialog):
|
|||
row = 1
|
||||
# Let's fill out the 'existing address' combo box with addresses from
|
||||
# the 'Your Identities' tab.
|
||||
configSections = shared.config.sections()
|
||||
for addressInKeysFile in configSections:
|
||||
if addressInKeysFile == 'bitmessagesettings':
|
||||
continue
|
||||
for addressInKeysFile in getSortedAccounts():
|
||||
self.ui.radioButtonExisting.click()
|
||||
self.ui.comboBoxExisting.addItem(
|
||||
addressInKeysFile)
|
||||
|
|
|
@ -10,6 +10,13 @@ from pyelliptic.openssl import OpenSSL
|
|||
from utils import str_broadcast_subscribers
|
||||
import time
|
||||
|
||||
def getSortedAccounts():
|
||||
configSections = filter(lambda x: x != 'bitmessagesettings', shared.config.sections())
|
||||
configSections.sort(cmp =
|
||||
lambda x,y: cmp(unicode(shared.config.get(x, 'label'), 'utf-8').lower(), unicode(shared.config.get(y, 'label'), 'utf-8').lower())
|
||||
)
|
||||
return configSections
|
||||
|
||||
def accountClass(address):
|
||||
if not shared.config.has_section(address):
|
||||
if address == str_broadcast_subscribers:
|
||||
|
|
Loading…
Reference in New Issue
Block a user