add ui templates for pending transmissions

This commit is contained in:
rra 2020-10-09 18:08:17 +02:00
parent 3b8fb66032
commit 6ed2310537
2 changed files with 53 additions and 3 deletions

View File

@ -10,11 +10,15 @@
</object>
<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="GtkImage">
<property name="width_request">50</property>
@ -36,6 +40,7 @@
<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">
@ -44,10 +49,12 @@
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="fileNameLabel">
<property name="width_request">70</property>
<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>
<property name="halign">start</property>
<property name="label" translatable="yes">screenshot_lkashdflasjdjasödjlkasjdlaskdlkashd01-292.jpg</property>
<property name="ellipsize">middle</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.2"/>
@ -63,6 +70,7 @@
<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>
@ -84,8 +92,9 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="halign">start</property>
<property name="margin_top">6</property>
<signal name="clicked" handler="transfer_button_click" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -110,6 +119,7 @@
<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>

40
ui_templates.py Normal file
View File

@ -0,0 +1,40 @@
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'
fileNameLabel = Gtk.Template.Child()
fileNameMetadata = Gtk.Template.Child()
transmissionCodeButton = Gtk.Template.Child()
cancelTransmission = 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
self.init_template()
#TODO (Roel)
self.fileNameLabel.set_ellipsize(2)
self.fileNameLabel.set_text(fileName)
self.transmissionCodeButton.set_label(transferCode)
@Gtk.Template.Callback()
def transfer_button_click(self,widget):
'''
what to do when we press the button:
copy the code again to clipboard
'''
print('click')
@Gtk.Template.Callback()
def cancel_transfer(self,widget):
'''
cancel the transfer
destroy thread
remove the object from the list
'''
print('poof!')