commit 76cbafe754940481fac862d6620ebb1c01d31b37
parent 19d7a81d702baf8a42fd9a5d567036a7c07293ff
Author: ThomasV <thomasv@gitorious>
Date: Thu, 5 Feb 2015 13:29:18 +0100
fix Master Public Keys dialog
Diffstat:
2 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -1907,39 +1907,44 @@ class ElectrumWindow(QMainWindow):
dialog.setModal(1)
dialog.setWindowTitle(_("Master Public Keys"))
- main_layout = QGridLayout()
mpk_dict = self.wallet.get_master_public_keys()
- # filter out the empty keys (PendingAccount)
- mpk_dict = {acc:mpk for acc,mpk in mpk_dict.items() if mpk}
-
+ vbox = QVBoxLayout()
# only show the combobox in case multiple accounts are available
if len(mpk_dict) > 1:
- combobox = QComboBox()
- for name in mpk_dict:
- combobox.addItem(name)
- combobox.setCurrentIndex(0)
- main_layout.addWidget(combobox, 1, 0)
-
- account = unicode(combobox.currentText())
- mpk_text = ShowQRTextEdit(text=mpk_dict[account])
+ gb = QGroupBox(_("Master Public Keys"))
+ vbox.addWidget(gb)
+ group = QButtonGroup()
+ first_button = None
+ for name in sorted(mpk_dict.keys()):
+ b = QRadioButton(gb)
+ b.setText(name)
+ group.addButton(b)
+ vbox.addWidget(b)
+ if not first_button:
+ first_button = b
+
+ mpk_text = ShowQRTextEdit()
mpk_text.setMaximumHeight(170)
- mpk_text.selectAll() # for easy copying
- main_layout.addWidget(mpk_text, 2, 0)
+ vbox.addWidget(mpk_text)
- def show_mpk(account):
- mpk = mpk_dict.get(unicode(account), "")
+ def show_mpk(b):
+ name = str(b.text())
+ mpk = mpk_dict.get(name, "")
mpk_text.setText(mpk)
+ mpk_text.selectAll() # for easy copying
- combobox.currentIndexChanged[str].connect(lambda acc: show_mpk(acc))
+ group.buttonReleased.connect(show_mpk)
+ first_button.setChecked(True)
+ show_mpk(first_button)
+
+ #combobox.currentIndexChanged[str].connect(lambda acc: show_mpk(acc))
elif len(mpk_dict) == 1:
mpk = mpk_dict.values()[0]
mpk_text = ShowQRTextEdit(text=mpk)
mpk_text.setMaximumHeight(170)
mpk_text.selectAll() # for easy copying
- main_layout.addWidget(mpk_text, 2, 0)
+ vbox.addWidget(mpk_text, 2, 0)
- vbox = QVBoxLayout()
- vbox.addLayout(main_layout)
vbox.addLayout(close_button(dialog))
dialog.setLayout(vbox)
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -1494,7 +1494,7 @@ class Wallet_2of2(BIP32_Wallet, Mnemonic):
def get_master_public_keys(self):
xpub1 = self.master_public_keys.get("x1/")
xpub2 = self.master_public_keys.get("x2/")
- return {'x1':xpub1, 'x2':xpub2}
+ return { 'Self':xpub1, 'Cosigner':xpub2 }
def get_action(self):
xpub1 = self.master_public_keys.get("x1/")