lightning: paste sample using clipboard

This commit is contained in:
Janus 2018-04-05 13:06:43 +02:00 committed by ThomasV
parent 6aebc0fd5d
commit ae7bce3385

View file

@ -28,8 +28,8 @@ Builder.load_string('''
text: _('Paste') text: _('Paste')
on_release: s.do_paste() on_release: s.do_paste()
Button: Button:
text: _('Paste sample') text: _('Paste using xclip')
on_release: s.do_paste_sample() on_release: s.do_paste_xclip()
Button: Button:
text: _('Clear') text: _('Clear')
on_release: s.do_clear() on_release: s.do_clear()
@ -60,8 +60,10 @@ class LightningPayerDialog(Factory.Popup):
def dismiss(self, *args, **kwargs): def dismiss(self, *args, **kwargs):
super(LightningPayerDialog, self).dismiss(*args, **kwargs) super(LightningPayerDialog, self).dismiss(*args, **kwargs)
self.app.wallet.network.lightningrpc.setConsole(None) self.app.wallet.network.lightningrpc.setConsole(None)
def do_paste_sample(self): def do_paste_xclip(self):
self.invoice_data = "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d73gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ecky03ylcqca784w" import subprocess
proc = subprocess.run(["xclip","-sel","clipboard","-o"], stdout=subprocess.PIPE)
self.invoice_data = proc.stdout.decode("ascii")
def do_paste(self): def do_paste(self):
contents = self.app._clipboard.paste() contents = self.app._clipboard.paste()
if not contents: if not contents: