From 9ec2ba9cd53ab9c38ed06a11ae8b3ea7576a5326 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 9 Oct 2022 00:58:04 +0200 Subject: [PATCH] Added copy to clipboard option to announce stream entries --- sbapp/ui/announces.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sbapp/ui/announces.py b/sbapp/ui/announces.py index c244e75..b7622a5 100644 --- a/sbapp/ui/announces.py +++ b/sbapp/ui/announces.py @@ -9,6 +9,7 @@ from kivymd.uix.menu import MDDropdownMenu from kivy.uix.gridlayout import GridLayout from kivy.uix.boxlayout import BoxLayout from kivy.clock import Clock +from kivy.core.clipboard import Clipboard from kivymd.uix.button import MDRectangleFlatButton from kivymd.uix.dialog import MDDialog @@ -155,6 +156,12 @@ class Announces(): self.app.conversation_from_announce_action(dest) return x + def gen_copy_addr(dest, item): + def x(): + Clipboard.copy(RNS.hexrep(dest, delimit=False)) + item.dmenu.dismiss() + return x + def gen_set_node(dest, item): def x(): item.dmenu.dismiss() @@ -171,6 +178,12 @@ class Announces(): "height": dp(40), "on_release": gen_conv(context_dest, item) }, + { + "viewclass": "OneLineListItem", + "text": "Copy address", + "height": dp(40), + "on_release": gen_copy_addr(context_dest, item) + }, { "text": "Delete Announce", "viewclass": "OneLineListItem", @@ -187,6 +200,12 @@ class Announces(): "height": dp(40), "on_release": gen_set_node(context_dest, item) }, + { + "viewclass": "OneLineListItem", + "text": "Copy address", + "height": dp(40), + "on_release": gen_copy_addr(context_dest, item) + }, { "text": "Delete Announce", "viewclass": "OneLineListItem",