Browse Source

pendingTransfers now shown in listbox

unifiedWindowUI
rra 4 years ago
parent
commit
2443410f48
  1. 10
      dropship.py
  2. 227
      pendingTransferRow.ui
  3. 200
      pendingTransmissions.ui
  4. 17
      ui_templates.py

10
dropship.py

@ -16,7 +16,7 @@ from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import Gtk
from ui_templates import pendingTransmissions
from ui_templates import pendingTransferRow
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
@ -91,8 +91,8 @@ 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")
# Pending Transfers UI
self.pending_transfers_list = self.builder.get_object("pendingTransfersList")
self.transfer_code = ''
@ -106,8 +106,8 @@ class DropShip:
self.nursery.start_soon(self.wormhole_send, fpath)
# TODO Roel/Luke, move this somewhere logical in its own function?
status = pendingTransmissions(self, fpath.split('/')[-1], self.transfer_code)
self.pending_box.add(status)
status = pendingTransferRow(self, fpath.split('/')[-1], self.transfer_code)
self.pending_transfers_list.add(status)
else:
log.info("Multiple file sending coming soon ™")

227
pendingTransferRow.ui

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-no</property>
<property name="icon_size">3</property>
</object>
<object class="GtkListBoxRow" id="pendingTransferRow">
<property name="width_request">100</property>
<property name="height_request">80</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="activatable">False</property>
<property name="selectable">False</property>
<child>
<object class="GtkBox">
<property name="name">pendingTransmission</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">2</property>
<property name="hexpand">True</property>
<child>
<object class="GtkStack" id="transferStatusStack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
<property name="margin_right">12</property>
<property name="margin_start">6</property>
<property name="margin_end">12</property>
<child>
<object class="GtkImage">
<property name="width_request">30</property>
<property name="height_request">30</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">network-transmit</property>
<property name="icon_size">5</property>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">dialog-ok</property>
<property name="icon_size">5</property>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="fileNameLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">screenshot_lkashdflasjdjasödjlkasjdlaskdlkashd01-292.jpg</property>
<property name="ellipsize">middle</property>
<property name="max_width_chars">20</property>
<property name="track_visited_links">False</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="fileNameMetadata">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">336 KB</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="transferCodeButton">
<property name="label" translatable="yes">5-courier-happening</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="margin_top">6</property>
<signal name="clicked" handler="copy_transfer_code" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkStack" id="statusButtonsStack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">6</property>
<property name="margin_start">12</property>
<property name="margin_end">6</property>
<property name="hhomogeneous">False</property>
<property name="transition_type">crossfade</property>
<child>
<object class="GtkButton" id="cancelTransfer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_top">16</property>
<property name="margin_bottom">16</property>
<property name="image">image1</property>
<signal name="clicked" handler="cancel_transfer" swapped="no"/>
<style>
<class name="circular"/>
</style>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_top">16</property>
<property name="margin_bottom">16</property>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

200
pendingTransmissions.ui

@ -1,200 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="PendingTransmission" parent="GtkBox">
<property name="name">pendingTransmission</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="hexpand">True</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<child>
<object class="GtkStack" id="transferStatusStack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">6</property>
<property name="margin_end">12</property>
<child>
<object class="GtkImage">
<property name="width_request">30</property>
<property name="height_request">30</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">network-transmit</property>
<property name="icon_size">5</property>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">dialog-ok</property>
<property name="icon_size">5</property>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="fileNameLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">screenshot_lkashdflasjdjasödjlkasjdlaskdlkashd01-292.jpg</property>
<property name="ellipsize">middle</property>
<property name="max_width_chars">20</property>
<property name="track_visited_links">False</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="fileNameMetadata">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">336 KB</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="transmissionCodeButton">
<property name="label" translatable="yes">5-courier-happening</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="margin_top">6</property>
<signal name="clicked" handler="transfer_button_click" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkStack" id="statusButtonsStack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">12</property>
<property name="margin_end">6</property>
<property name="hhomogeneous">False</property>
<property name="transition_type">crossfade</property>
<child>
<object class="GtkButton" id="cancelTransmission">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_top">16</property>
<property name="margin_bottom">16</property>
<property name="image">image1</property>
<signal name="clicked" handler="cancel_transfer" swapped="no"/>
<style>
<class name="circular"/>
</style>
</object>
<packing>
<property name="name">page0</property>
<property name="title" translatable="yes">page0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_top">16</property>
<property name="margin_bottom">16</property>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">page1</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</template>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-no</property>
<property name="icon_size">3</property>
</object>
</interface>

17
ui_templates.py

@ -2,27 +2,24 @@ import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib, Gdk
@Gtk.Template.from_file('pendingTransmissions.ui')
class pendingTransmissions(Gtk.Box):
__gtype_name__ = 'PendingTransmission'
@Gtk.Template.from_file('pendingTransferRow.ui')
class pendingTransferRow(Gtk.ListBoxRow):
__gtype_name__ = 'PendingTransferRow'
fileNameLabel = Gtk.Template.Child()
fileNameMetadata = Gtk.Template.Child()
transmissionCodeButton = Gtk.Template.Child()
cancelTransmission = Gtk.Template.Child()
transferCodeButton = Gtk.Template.Child()
cancelTransfer = Gtk.Template.Child()
def __init__(self, parent, fileName, transferCode):
super(Gtk.Box, self).__init__()
#Gtk.Frame.__init__(self)
# This must occur *after* you initialize your base
super(Gtk.ListBoxRow, self).__init__()
self.init_template()
#TODO (Roel)
self.fileNameLabel.set_text(fileName)
self.transmissionCodeButton.set_label(transferCode)
@Gtk.Template.Callback()
def transfer_button_click(self,widget):
def copy_transfer_code(self,widget):
'''
what to do when we press the button:
copy the code again to clipboard

Loading…
Cancel
Save