add gui
This commit is contained in:
parent
b98a137946
commit
c194d9a735
2 changed files with 125 additions and 0 deletions
39
sweecrypt-gtk.py
Normal file
39
sweecrypt-gtk.py
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*-
|
||||||
|
#
|
||||||
|
# main.py
|
||||||
|
# Copyright (C) 2024 Swee
|
||||||
|
#
|
||||||
|
|
||||||
|
from gi.repository import Gtk, GdkPixbuf, Gdk
|
||||||
|
import os, sys
|
||||||
|
|
||||||
|
|
||||||
|
#Comment the first line and uncomment the second before installing
|
||||||
|
#or making the tarball (alternatively, use project variables)
|
||||||
|
UI_FILE = os.path.dirname(os.path.realpath(__file__)) + "/sweecrypt-gtk.ui"
|
||||||
|
#UI_FILE = "/usr/local/share/sweecrypt_gui/ui/sweecrypt_gui.ui"
|
||||||
|
|
||||||
|
|
||||||
|
class GUI:
|
||||||
|
def __init__(self):
|
||||||
|
|
||||||
|
self.builder = Gtk.Builder()
|
||||||
|
self.builder.add_from_file(UI_FILE)
|
||||||
|
self.builder.connect_signals(self)
|
||||||
|
|
||||||
|
window = self.builder.get_object('window')
|
||||||
|
|
||||||
|
|
||||||
|
window.show_all()
|
||||||
|
|
||||||
|
def on_window_destroy(self, window):
|
||||||
|
Gtk.main_quit()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app = GUI()
|
||||||
|
Gtk.main()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
|
86
sweecrypt-gtk.ui
Normal file
86
sweecrypt-gtk.ui
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!-- Generated with glade 3.40.0 -->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk+" version="3.24"/>
|
||||||
|
<object class="GtkImage" id="image1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="icon-name">edit-copy</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkImage" id="image2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="icon-name">document-revert</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkImage" id="start">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="icon-name">document-properties</property>
|
||||||
|
</object>
|
||||||
|
<object class="GtkWindow" id="window">
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="icon-name">sweecrypt</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTextView">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="monospace">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleButton">
|
||||||
|
<property name="label" translatable="yes">Encode</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<property name="image">image1</property>
|
||||||
|
<property name="active">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkToggleButton">
|
||||||
|
<property name="label" translatable="yes">Decode</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<property name="image">image2</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="label" translatable="yes">Start</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="receives-default">True</property>
|
||||||
|
<property name="image">start</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</interface>
|
Loading…
Reference in a new issue