Added copy to clipboard option to announce stream entries

This commit is contained in:
Mark Qvist 2022-10-09 00:58:04 +02:00
parent 52ec09a7df
commit 9ec2ba9cd5

View File

@ -9,6 +9,7 @@ from kivymd.uix.menu import MDDropdownMenu
from kivy.uix.gridlayout import GridLayout from kivy.uix.gridlayout import GridLayout
from kivy.uix.boxlayout import BoxLayout from kivy.uix.boxlayout import BoxLayout
from kivy.clock import Clock from kivy.clock import Clock
from kivy.core.clipboard import Clipboard
from kivymd.uix.button import MDRectangleFlatButton from kivymd.uix.button import MDRectangleFlatButton
from kivymd.uix.dialog import MDDialog from kivymd.uix.dialog import MDDialog
@ -155,6 +156,12 @@ class Announces():
self.app.conversation_from_announce_action(dest) self.app.conversation_from_announce_action(dest)
return x 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 gen_set_node(dest, item):
def x(): def x():
item.dmenu.dismiss() item.dmenu.dismiss()
@ -171,6 +178,12 @@ class Announces():
"height": dp(40), "height": dp(40),
"on_release": gen_conv(context_dest, item) "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", "text": "Delete Announce",
"viewclass": "OneLineListItem", "viewclass": "OneLineListItem",
@ -187,6 +200,12 @@ class Announces():
"height": dp(40), "height": dp(40),
"on_release": gen_set_node(context_dest, item) "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", "text": "Delete Announce",
"viewclass": "OneLineListItem", "viewclass": "OneLineListItem",