From a3584bb141f1cce5005732786b702cd55623c6ef Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Tue, 25 Oct 2016 02:47:28 +0200 Subject: [PATCH] "From" combobox empty fix - if label of your address is empty, the "From" combo box showed an empty entry (just the identicon). Now it shows the address instead - fixes #898 --- src/bitmessageqt/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index d44d54d8..29217981 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2181,8 +2181,10 @@ class MyForm(settingsmixin.SMainWindow): 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.addItem(avatarize(addressInKeysFile), unicode(shared.config.get( - addressInKeysFile, 'label'), 'utf-8'), addressInKeysFile) + label = unicode(shared.config.get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip() + if label == "": + label = addressInKeysFile + self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), label, addressInKeysFile) # self.ui.comboBoxSendFrom.model().sort(1, Qt.AscendingOrder) for i in range(self.ui.comboBoxSendFrom.count()): address = str(self.ui.comboBoxSendFrom.itemData(i, Qt.UserRole).toString()) @@ -2200,8 +2202,10 @@ class MyForm(settingsmixin.SMainWindow): addressInKeysFile, 'enabled') # I realize that this is poor programming practice but I don't care. It's easier for others to read. isChan = shared.safeConfigGetBoolean(addressInKeysFile, 'chan') if isEnabled and not isChan: - self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), unicode(shared.config.get( - addressInKeysFile, 'label'), 'utf-8'), addressInKeysFile) + label = unicode(shared.config.get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip() + if label == "": + label = addressInKeysFile + self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), label, addressInKeysFile) for i in range(self.ui.comboBoxSendFromBroadcast.count()): address = str(self.ui.comboBoxSendFromBroadcast.itemData(i, Qt.UserRole).toString()) self.ui.comboBoxSendFromBroadcast.setItemData(i, AccountColor(address).accountColor(), Qt.ForegroundRole)