Browse Source

column for payment request memo

283
ThomasV 11 years ago
parent
commit
89a1b48ba1
  1. 20
      gui/qt/main_window.py
  2. 3
      lib/paymentrequest.py

20
gui/qt/main_window.py

@ -925,7 +925,7 @@ class ElectrumWindow(QMainWindow):
pr = self.gui_object.payment_request pr = self.gui_object.payment_request
pr_id = pr.get_id() pr_id = pr.get_id()
# save it # save it
self.invoices[pr_id] = (pr.get_domain(), pr.get_amount()) self.invoices[pr_id] = (pr.get_domain(), pr.get_memo(), pr.get_amount())
self.wallet.storage.put('invoices', self.invoices) self.wallet.storage.put('invoices', self.invoices)
self.update_invoices_tab() self.update_invoices_tab()
@ -1050,7 +1050,10 @@ class ElectrumWindow(QMainWindow):
def create_invoices_tab(self): def create_invoices_tab(self):
l, w = self.create_list_tab([_('Requestor'), _('Amount'), _('Status')]) l, w = self.create_list_tab([_('Requestor'), _('Memo'),_('Amount'), _('Status')])
h = l.header()
h.setStretchLastSection(False)
h.setResizeMode(1, QHeaderView.Stretch)
l.setContextMenuPolicy(Qt.CustomContextMenu) l.setContextMenuPolicy(Qt.CustomContextMenu)
l.customContextMenuRequested.connect(self.create_invoice_menu) l.customContextMenuRequested.connect(self.create_invoice_menu)
self.invoices_list = l self.invoices_list = l
@ -1060,10 +1063,13 @@ class ElectrumWindow(QMainWindow):
invoices = self.wallet.storage.get('invoices', {}) invoices = self.wallet.storage.get('invoices', {})
l = self.invoices_list l = self.invoices_list
l.clear() l.clear()
for key, value in invoices.items():
for item, value in invoices.items(): try:
domain, amount = value domain, memo, amount = value
item = QTreeWidgetItem( [ domain, self.format_amount(amount), ""] ) except:
invoices.pop(key)
continue
item = QTreeWidgetItem( [ domain, memo, self.format_amount(amount), ""] )
l.addTopLevelItem(item) l.addTopLevelItem(item)
l.setCurrentItem(l.topLevelItem(0)) l.setCurrentItem(l.topLevelItem(0))
@ -1214,7 +1220,7 @@ class ElectrumWindow(QMainWindow):
def show_invoice(self, key): def show_invoice(self, key):
from electrum.paymentrequest import PaymentRequest from electrum.paymentrequest import PaymentRequest
domain, value = self.invoices[key] domain, memo, value = self.invoices[key]
pr = PaymentRequest(self.config) pr = PaymentRequest(self.config)
pr.read_file(key) pr.read_file(key)
pr.domain = domain pr.domain = domain

3
lib/paymentrequest.py

@ -272,6 +272,9 @@ class PaymentRequest:
def get_domain(self): def get_domain(self):
return self.domain return self.domain
def get_memo(self):
return self.memo
def get_id(self): def get_id(self):
return self.id return self.id

Loading…
Cancel
Save