commit b9d270d438a826c944840bf34c5435be4260e09d
parent f3c4a55e77ef648310b835f95197776cb2584661
Author: ThomasV <thomasv@gitorious>
Date: Tue, 7 Jul 2015 14:15:11 +0200
add alias field to settings
Diffstat:
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -711,15 +711,16 @@ class ElectrumWindow(QMainWindow):
message = unicode(self.receive_message_e.text())
if not message and not amount:
QMessageBox.warning(self, _('Error'), _('No message or amount'), _('OK'))
- return
+ return False
i = self.expires_combo.currentIndex()
expiration = map(lambda x: x[1], expiration_values)[i]
self.wallet.add_payment_request(addr, amount, message, expiration, self.config)
self.update_receive_tab()
self.update_address_tab()
self.save_request_button.setEnabled(False)
+ return True
- def export_payment_request(self, addr):
+ def make_payment_request(self, addr):
alias = str(self.config.get('alias'))
alias_privkey = None
if alias:
@@ -729,9 +730,12 @@ class ElectrumWindow(QMainWindow):
if alias_addr and self.wallet.is_mine(alias_addr):
password = self.password_dialog()
alias_privkey = self.wallet.get_private_key(alias_addr, password)[0]
-
r = self.wallet.get_payment_request(addr, self.config)
pr = paymentrequest.make_request(self.config, r, alias, alias_privkey)
+ return pr
+
+ def export_payment_request(self, addr):
+ pr = self.make_payment_request(addr)
name = r['id'] + '.bip70'
fileName = self.getSaveFileName(_("Select where to save your payment request"), name, "*.bip70")
if fileName:
@@ -2502,9 +2506,17 @@ class ElectrumWindow(QMainWindow):
self.update_fee()
fee_e.editingFinished.connect(lambda: on_fee(True))
fee_e.textEdited.connect(lambda: on_fee(False))
-
widgets.append((fee_label, fee_e, fee_help))
+ alias_label = QLabel(_('Alias') + ':')
+ alias_help = HelpButton(_('OpenAlias TXT record, used to receive coins and to sign payment requests'))
+ alias_e = QLineEdit(self.config.get('alias',''))
+ def on_alias():
+ alias = str(alias_e.text())
+ self.config.set_key('alias', alias, True)
+ alias_e.editingFinished.connect(on_alias)
+ widgets.append((alias_label, alias_e, alias_help))
+
units = ['BTC', 'mBTC', 'bits']
unit_label = QLabel(_('Base unit') + ':')
unit_combo = QComboBox()