tlightning: assert result type, add invoice qr dialog - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1a05838ef21ff8eb69e7f25a1537346c0b8394f9 DIR parent afa5797099cff6e448f07596a6c501a9e67fe208 HTML Author: Janus <ysangkok@gmail.com> Date: Wed, 28 Mar 2018 17:37:17 +0200 lightning: assert result type, add invoice qr dialog Diffstat: M gui/qt/lightning_invoice_list.py | 5 +++++ M lib/lightning.py | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) --- DIR diff --git a/gui/qt/lightning_invoice_list.py b/gui/qt/lightning_invoice_list.py t@@ -5,6 +5,7 @@ from PyQt5 import QtCore, QtWidgets from collections import OrderedDict import logging from electrum.lightning import lightningCall +from .qrcodewidget import QRDialog mapping = {0: "r_hash", 1: "pay_req", 2: "settled"} revMapp = {"r_hash": 0, "pay_req": 1, "settled": 2} t@@ -61,7 +62,11 @@ class LightningInvoiceList(QtWidgets.QWidget): def copy(): print(pay_req) cb.setText(pay_req) + def qr(): + d = QRDialog(pay_req, self, "Lightning invoice") + d.exec_() menu.addAction("Copy payment request", copy) + menu.addAction("Show payment request as QR code", qr) menu.exec_(self._tv.viewport().mapToGlobal(position)) def lightningWorkerHandler(self, sourceClassName, obj): new = {} DIR diff --git a/lib/lightning.py b/lib/lightning.py t@@ -625,6 +625,7 @@ class LightningRPC: raise toprint = result try: + assert type(result) is not str, result assert result["stderr"] == "" and result["returncode"] == 0, "LightningRPC detected error: " + result["stderr"] toprint = json.loads(result["stdout"]) for i in self.subscribers: applyMethodName(i)(toprint)