Compare commits

...

1 Commits

Author SHA1 Message Date
rra
3080d1479f quick sketch of how it could work in a single window 2020-10-13 17:44:06 +02:00
2 changed files with 274 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class DropShip:
def __init__(self, nursery):
"""Object initialisation."""
self.GLADE_FILE = f"{UI_DIR}/dropship.ui"
self.GLADE_FILE = f"{UI_DIR}/dropship_tabless.ui"
self.CSS_FILE = f"{UI_DIR}/dropship.css"
self.clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
@ -80,6 +80,16 @@ class DropShip:
"Cancel", Gtk.ResponseType.CANCEL, "Add", Gtk.ResponseType.OK
)
#sendReceiveStack
self.sendReceiveStack = self.builder.get_object("sendReceiveStack")
#drag and drop in pending view
self.pendingdrop_box = self.builder.get_object("pendingDragDrop")
self.pendingdrop_box.drag_dest_set(
Gtk.DestDefaults.ALL, [self.enforce_target], Gdk.DragAction.COPY
)
self.pendingdrop_box.connect("drag-data-received", self.on_drop)
# Receive UI
# Code entry box
self.recv_box = self.builder.get_object("receiveBoxCodeEntry")
@ -147,6 +157,8 @@ class DropShip:
self._create_pending_transfer(fpath, code, scope)
self.clipboard.set_text(code, -1)
self._send_spinner_off(code)
pending_view = self.sendReceiveStack.get_child_by_name('Pending')
self.sendReceiveStack.set_visible_child(pending_view)
log.info(f"send: successfully initiated transfer send ({code})")
async def receive(self, code):

View File

@ -0,0 +1,261 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkApplicationWindow" id="mainWindow">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="default_width">250</property>
<property name="default_height">250</property>
<child>
<object class="GtkStack" id="sendReceiveStack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="transition_type">crossfade</property>
<child>
<object class="GtkEventBox" id="dropBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="button-press-event" handler="add_files" swapped="no"/>
<child>
<object class="GtkBox" id="dragActionContainer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">16</property>
<property name="margin_right">16</property>
<property name="margin_start">16</property>
<property name="margin_end">16</property>
<property name="margin_top">16</property>
<property name="margin_bottom">16</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="dropLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Drag a file
drop it here
..and ship it </property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="dropSpinner">
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="drop"/>
</style>
</object>
</child>
</object>
<packing>
<property name="name">dragAndDrop</property>
<property name="title" translatable="yes">Send</property>
</packing>
</child>
<child>
<object class="GtkBox" id="receiveBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkEntry" id="receiveBoxCodeEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_left">16</property>
<property name="margin_right">16</property>
<property name="primary_icon_stock">gtk-paste</property>
<property name="placeholder_text" translatable="yes">Transfer Code</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">receiveView</property>
<property name="title" translatable="yes">Receive</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="pendingDragDrop">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="pendingBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">16</property>
<property name="margin_end">16</property>
<property name="margin_top">16</property>
<property name="margin_bottom">16</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<child>
<object class="GtkLabel" id="dropLabel1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Drag a file to send</property>
</object>
<packing>
<property name="expand">True</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="orientation">vertical</property>
<child>
<object class="GtkEntry" id="receiveBoxCodeEntry1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_stock">gtk-paste</property>
<property name="placeholder_text" translatable="yes">Transfer Code</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</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="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="margin_bottom">6</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkListBox" id="pendingTransfersList">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="drop"/>
</style>
</object>
</child>
</object>
<packing>
<property name="name">Pending</property>
<property name="title" translatable="yes">Pending</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<object class="GtkFileChooserDialog" id="filePicker">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Choose files to ship</property>
<property name="type_hint">dialog</property>
<property name="transient_for">mainWindow</property>
<property name="has_resize_grip">True</property>
<property name="select_multiple">True</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>