X-Git-Url: https://git.novaco.in/?p=electrum-nvc.git;a=blobdiff_plain;f=plugins%2Fqrscanner.py;h=0ff1fe936c7c83959800a0e3594f3853b547000a;hp=c42347c27cb5dfa3142c1cfd614f4eda57b11e2d;hb=81d1e67253c8ca581e821a6cd9e5ee1502fffd08;hpb=4da85c00e313d3e087f52d3c7263e79553ef8147 diff --git a/plugins/qrscanner.py b/plugins/qrscanner.py index c42347c..0ff1fe9 100644 --- a/plugins/qrscanner.py +++ b/plugins/qrscanner.py @@ -46,18 +46,14 @@ class Plugin(BasePlugin): def init(self): self.win = self.gui.main_window - self.win.raw_transaction_menu.addAction(_("&From QR code"), self.read_raw_qr) def is_available(self): return self._is_available - def scan_qr_hook(self, func): - data = self.scan_qr() - if type(data) != str: - return - func(data) + def is_enabled(self): + return True - def scan_qr(self): + def scan_qr_hook(self): proc = zbar.Processor() try: proc.init(video_device=self.video_device()) @@ -80,23 +76,6 @@ class Plugin(BasePlugin): return r.data - def read_raw_qr(self): - qrcode = self.scan_qr() - if not qrcode: - return - 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) - def video_device(self): device = self.config.get("video_device", "default") if device == 'default':