here we go

This commit is contained in:
rra 2020-07-21 14:48:34 +02:00
commit 9854f12f43
5 changed files with 158 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.pyc
*~

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# dropship
lets try magic wormhole with a nice interface
## what is what:
`dropship.py`, run this with python3
`dropship.glade`, UI file, edit with glade
`dropship.css`, additional styling for UI.

6
dropship.css Normal file
View File

@ -0,0 +1,6 @@
.drop {
border-style:dashed;
border-width:2px;
border-color:rgba(0,0,0,0.25);
border-radius: 5px;
}

105
dropship.glade Normal file
View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<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 type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkStackSwitcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stack">mainStack</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkStack" id="mainStack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkEventBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="dropBox">
<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_top">16</property>
<property name="margin_bottom">16</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Drag a file to send</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</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">
<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="text" translatable="yes">Transfer ID</property>
<property name="primary_icon_stock">gtk-paste</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>
</object>
</child>
</object>
</interface>

32
dropship.py Normal file
View File

@ -0,0 +1,32 @@
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib, Gdk
class Main:
def __init__(self):
self.timer = None
self.event = None
self.timer_running = False
# Connect to the Glade file
self.builder = Gtk.Builder()
self.builder.add_from_file('dropship.glade')
self.builder.connect_signals(self)
# Connect to the Stylesheet
screen = Gdk.Screen.get_default()
provider = Gtk.CssProvider()
provider.load_from_path("./dropship.css")
Gtk.StyleContext.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
window = self.builder.get_object("mainWindow")
window.connect('delete-event', Gtk.main_quit)
window.show()
#self.stack = self.builder.get_object("mainStack")
if __name__ == '__main__':
main = Main()
Gtk.main()