Luke Murphy
4 years ago
5 changed files with 333 additions and 172 deletions
@ -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> |
@ -1,130 +0,0 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!-- Generated with glade 3.22.1 --> |
|||
<interface> |
|||
<requires lib="gtk+" version="3.20"/> |
|||
<template class="PendingTransmission" parent="GtkBox"> |
|||
<property name="name">pendingTransmission</property> |
|||
<property name="can_focus">False</property> |
|||
<property name="decorated">False</property> |
|||
<child type="titlebar"> |
|||
<placeholder/> |
|||
</child> |
|||
<child> |
|||
<object class="GtkBox"> |
|||
<property name="visible">True</property> |
|||
<property name="can_focus">False</property> |
|||
<child> |
|||
<object class="GtkImage"> |
|||
<property name="width_request">50</property> |
|||
<property name="height_request">50</property> |
|||
<property name="visible">True</property> |
|||
<property name="can_focus">False</property> |
|||
<property name="stock">gtk-network</property> |
|||
<property name="icon_size">6</property> |
|||
</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="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="label" translatable="yes">screenshot_01-292.jpg</property> |
|||
<property name="ellipsize">end</property> |
|||
<attributes> |
|||
<attribute name="weight" value="bold"/> |
|||
<attribute name="scale" value="1.2"/> |
|||
</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="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> |
|||
</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="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> |
|||
<style> |
|||
<class name="circular"/> |
|||
</style> |
|||
</object> |
|||
<packing> |
|||
<property name="expand">False</property> |
|||
<property name="fill">True</property> |
|||
<property name="position">2</property> |
|||
</packing> |
|||
</child> |
|||
</object> |
|||
</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> |
@ -0,0 +1,40 @@ |
|||
import gi |
|||
gi.require_version('Gtk', '3.0') |
|||
from gi.repository import Gtk, GLib, Gdk |
|||
|
|||
@Gtk.Template.from_file('pendingTransferRow.ui') |
|||
class pendingTransferRow(Gtk.ListBoxRow): |
|||
__gtype_name__ = 'PendingTransferRow' |
|||
|
|||
fileNameLabel = Gtk.Template.Child() |
|||
fileNameMetadata = Gtk.Template.Child() |
|||
transferCodeButton = Gtk.Template.Child() |
|||
cancelTransfer = Gtk.Template.Child() |
|||
|
|||
def __init__(self, parent, fileName, transferCode): |
|||
super(Gtk.ListBoxRow, self).__init__() |
|||
self.init_template() |
|||
|
|||
self.fileNameLabel.set_text(fileName) |
|||
self.transferCodeButton.set_label(transferCode) |
|||
|
|||
@Gtk.Template.Callback() |
|||
def copy_transfer_code(self,widget): |
|||
''' |
|||
what to do when we press the button: |
|||
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): |
|||
''' |
|||
cancel the transfer |
|||
destroy thread |
|||
remove the object from the list |
|||
''' |
|||
print('poof!') |
Loading…
Reference in new issue