copy code to clipboard automagically

This commit is contained in:
rra 2020-10-10 18:37:17 +02:00
parent 46761036cc
commit d98ea0de8a
2 changed files with 7 additions and 2 deletions

View File

@ -138,6 +138,8 @@ class DropShip:
output = await process.stderr.receive_some()
code = output.decode().split()[-1]
self.clipboard.set_text(code, -1)
self.transfer_code = code
self.drop_label.set_text(code)

View File

@ -17,9 +17,8 @@ class pendingTransmissions(Gtk.Box):
# This must occur *after* you initialize your base
self.init_template()
#TODO (Roel)
self.fileNameLabel.set_ellipsize(2)
self.fileNameLabel.set_text(fileName)
self.fileNameLabel.set_text(fileName)
self.transmissionCodeButton.set_label(transferCode)
@Gtk.Template.Callback()
@ -29,6 +28,10 @@ class pendingTransmissions(Gtk.Box):
copy the code again to clipboard
'''
print('click')
code = widget.get_label()
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.set_text(code, -1) #-1 is auto-size
@Gtk.Template.Callback()
def cancel_transfer(self,widget):