commit 62fe3a411b2e052c2d17d1d330879e11e4b03c9c
parent 93d7aebae473db79d04c7bf41c9b2691255589ac
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 27 Oct 2017 11:20:39 +0200
Merge pull request #3133 from SomberNight/payment_req1
fix: payment request related stuff
Diffstat:
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/gui/qt/invoice_list.py b/gui/qt/invoice_list.py
@@ -70,8 +70,8 @@ class InvoiceList(MyTreeWidget):
item = self.itemAt(position)
if not item:
return
- key = item.data(0, 32)
- column = self.currentColumn()
+ key = item.data(0, Qt.UserRole)
+ column = self.currentColumn()
column_title = self.headerItem().text(column)
column_data = item.text(column)
pr = self.parent.invoices.get(key)
diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
@@ -1684,10 +1684,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
grid.addWidget(QLabel(format_time(expires)), 4, 1)
vbox.addLayout(grid)
def do_export():
- fn = self.getOpenFileName(_("Save invoice to file"), "*.bip70")
+ fn = self.getSaveFileName(_("Save invoice to file"), "*.bip70")
if not fn:
return
- with open(fn, 'w') as f:
+ with open(fn, 'wb') as f:
data = f.write(pr.raw)
self.show_message(_('Invoice saved as' + ' ' + fn))
exportButton = EnterButton(_('Save'), do_export)
@@ -1695,6 +1695,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
if self.question(_('Delete invoice?')):
self.invoices.remove(key)
self.history_list.update()
+ self.invoice_list.update()
d.close()
deleteButton = EnterButton(_('Delete'), do_delete)
vbox.addLayout(Buttons(exportButton, deleteButton, CloseButton(d)))
diff --git a/lib/paymentrequest.py b/lib/paymentrequest.py
@@ -480,6 +480,7 @@ class InvoiceStore(object):
d = json.loads(f.read())
self.load(d)
except:
+ traceback.print_exc(file=sys.stderr)
return
self.save()
@@ -495,6 +496,9 @@ class InvoiceStore(object):
def get_status(self, key):
pr = self.get(key)
+ if pr is None:
+ print_error("[InvoiceStore] get_status() can't find pr for", key)
+ return
if pr.tx is not None:
return PR_PAID
if pr.has_expired():