tMerge pull request #3133 from SomberNight/payment_req1 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 62fe3a411b2e052c2d17d1d330879e11e4b03c9c DIR parent 93d7aebae473db79d04c7bf41c9b2691255589ac HTML 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: M gui/qt/invoice_list.py | 4 ++-- M gui/qt/main_window.py | 5 +++-- M lib/paymentrequest.py | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) --- DIR diff --git a/gui/qt/invoice_list.py b/gui/qt/invoice_list.py t@@ -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) DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -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) t@@ -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))) DIR diff --git a/lib/paymentrequest.py b/lib/paymentrequest.py t@@ -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() t@@ -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():