From 431f5456f30291d40a6afa9a4c3ec8b18afff8ca Mon Sep 17 00:00:00 2001 From: rra Date: Wed, 7 Oct 2020 18:12:18 +0200 Subject: [PATCH 1/9] add labels and types --- dropship.glade | 2 +- pendingTransmissions.ui | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dropship.glade b/dropship.glade index 8d00b0b..be802e1 100644 --- a/dropship.glade +++ b/dropship.glade @@ -111,7 +111,7 @@ - + True False 16 diff --git a/pendingTransmissions.ui b/pendingTransmissions.ui index f7b98cc..11b5e80 100644 --- a/pendingTransmissions.ui +++ b/pendingTransmissions.ui @@ -2,13 +2,15 @@ + + True + False + gtk-no + 3 + - - True - False - gtk-no - 3 - From 3b8fb6603223acad5578c9083c9bb2a0db9cd485 Mon Sep 17 00:00:00 2001 From: rra Date: Wed, 7 Oct 2020 18:13:46 +0200 Subject: [PATCH 2/9] try to add templates but ughhhh --- dropship.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/dropship.py b/dropship.py index e726e2e..c51f057 100644 --- a/dropship.py +++ b/dropship.py @@ -92,13 +92,20 @@ class DropShip: self.recv_box = self.builder.get_object("receiveBoxCodeEntry") self.recv_box.connect("activate", self.on_recv) + # Pending Transmissions UI + self.pending_box = self.builder.get_object("pendingBox") + self.transfer_code = '' + def on_drop(self, widget, drag_context, x, y, data, info, time): """Handler for file dropping.""" files = data.get_uris() self.files_to_send = files if len(files) == 1: fpath = files[0].replace("file://", "") + status = pendingTransmissions(fpath, self.transfer_code) + self.pending_box.add(status, True, True, 0) self.nursery.start_soon(self.wormhole_send, fpath) + else: log.info("Multiple file sending coming soon ™") @@ -127,9 +134,9 @@ class DropShip: self.drop_spinner.start() output = await process.stderr.receive_some() - code = output.decode().split()[-1] + self.transfer_code = output.decode().split()[-1] - self.drop_label.set_text(code) + self.drop_label.set_text(self.transfer_code) self.drop_label.set_visible(True) self.drop_label.set_selectable(True) @@ -144,6 +151,23 @@ class DropShip: command = ["wormhole", "receive", "--accept-file", code] await trio.run_process(command, stderr=PIPE) +@gtk.Template.from_file('pendingTransmissions.ui') +class pendingTransmissions(gtk.Box): + __gtype_name__ = 'PendingTransmission' + + +fileNameLabel = gtk.Template.Child('fileNameLabel') +fileNameMetadata = gtk.Template.Child('fileNameMetadata') +transmissionCodeButton = gtk.Template.Child('transmissionCodeButton') +cancelTransmission = gtk.Template.Child('cancelTransmission') + +def __init__(self, widget, fileName, transferCode): + super(Gtk.Box, self).__init__() + + self.init_template() + + self.fileNameLabel.set_text(fileName) + self.transmissionCodeButton.set_label(transferCode) async def main(): """Trio main entrypoint.""" From 6ed2310537450db837dea7942b7a7c74b6f9835e Mon Sep 17 00:00:00 2001 From: rra Date: Fri, 9 Oct 2020 18:08:17 +0200 Subject: [PATCH 3/9] add ui templates for pending transmissions --- pendingTransmissions.ui | 16 +++++++++++++--- ui_templates.py | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 ui_templates.py diff --git a/pendingTransmissions.ui b/pendingTransmissions.ui index 11b5e80..9cb951f 100644 --- a/pendingTransmissions.ui +++ b/pendingTransmissions.ui @@ -10,11 +10,15 @@