Browse Source

fix: payment request related stuff (qt crash, exporting, refresh bug)

seed_v14
SomberNight 7 years ago
parent
commit
0d0f8c5842
  1. 4
      gui/qt/invoice_list.py
  2. 5
      gui/qt/main_window.py
  3. 4
      lib/paymentrequest.py

4
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)

5
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)))

4
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():

Loading…
Cancel
Save