define frozen signal for exchange rate plugin
[electrum-nvc.git] / plugins / qrscanner.py
index 8599e7c..66a05d9 100644 (file)
@@ -46,11 +46,6 @@ class Plugin(BasePlugin):
         self.win = self.gui.main_window
         self.win.raw_transaction_menu.addAction(_("&From QR code"), self.read_raw_qr)
 
-    def init_transaction_dialog(self, dialog, buttons):
-        b = QPushButton(_("Show QR code"))
-        b.clicked.connect(lambda: self.show_raw_qr(dialog.tx))
-        buttons.insertWidget(1,b)
-
     def is_available(self):
         return self._is_available
 
@@ -82,19 +77,20 @@ class Plugin(BasePlugin):
                     continue
                 return r.data
         
-    def show_raw_qr(self, tx):
-        try:
-            json_text = json.dumps(tx.as_dict()).replace(' ', '')
-            self.win.show_qrcode(json_text, 'Transaction')
-        except Exception as e:
-            self.win.show_message(str(e))
-
 
     def read_raw_qr(self):
         qrcode = self.scan_qr()
         if not qrcode:
             return
-        tx = self.win.tx_from_text(qrcode)
+        data = qrcode
+
+        # transactions are binary, but qrcode seems to return utf8...
+        z = data.decode('utf8')
+        s = ''
+        for b in z:
+            s += chr(ord(b))
+        data = s.encode('hex')
+        tx = self.win.tx_from_text(data)
         if not tx:
             return
         self.win.show_transaction(tx)