Create dpkg package data, create a patched version of the app for system installation

This commit is contained in:
Swee 2024-09-09 23:35:49 -07:00
parent 0061d5aa23
commit f65368ba5a
4 changed files with 148 additions and 0 deletions

8
dpkg/DEBIAN/control Normal file
View file

@ -0,0 +1,8 @@
Package: sweecrypt-gtk
Version: 1.0
Section: utils
Priority: optional
Architecture: all
Maintainer: Swee <swee@mailfence.com>
Description: A GUI for the SweeCrypt cipher.
Depends: python3 | python3-gi | python3-gi-cairo | python3-sweecrypt | gir1.2-gtk-3.0

96
dpkg/opt/sweecrypt-gtk.ui Normal file
View file

@ -0,0 +1,96 @@
<?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="GtkTextBuffer" id="text">
<property name="text" translatable="yes">replace this text with anything
you want to encode or decode.</property>
</object>
<object class="GtkWindow" id="window">
<property name="can-focus">False</property>
<property name="title" translatable="yes">SweeCrypt GTK</property>
<property name="icon-name">sweecrypt</property>
<signal name="destroy" handler="on_window_destroy" swapped="no"/>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkTextView" id="input">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="buffer">text</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" id="encode">
<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>
<signal name="toggled" handler="encode_toggle" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="decode">
<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>
<signal name="toggled" handler="decode_toggle" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="star">
<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>
<signal name="clicked" handler="start_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View file

@ -0,0 +1,36 @@
#!/usr/bin/python3
import gi, os, sys, sweecrypt as sc
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GdkPixbuf, Gdk
UI_FILE = "/opt/sweecrypt-gtk.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 toggle(self, e:bool):
if e:
active = self.builder.get_object('encode').get_property("active")
self.builder.get_object('decode').set_property("active", not active)
else:
active = self.builder.get_object('decode').get_property("active")
self.builder.get_object('encode').set_property("active", not active)
def on_window_destroy(self, window):Gtk.main_quit()
def encode_toggle(self, encode):self.toggle(True)
def decode_toggle(self, decode):self.toggle(False)
def start_clicked(self, start):
encode = self.builder.get_object('encode').get_property("active")
inputted = self.builder.get_object('text').get_property("text")
if encode:
self.builder.get_object('text').set_property("text", sc.encrypt(inputted))
self.builder.get_object('encode').set_property("active", False)
else:
self.builder.get_object('text').set_property("text", sc.decrypt(inputted))
self.builder.get_object('decode').set_property("active", False)
def main():
app = GUI()
Gtk.main()
if __name__ == "__main__":
sys.exit(main())

View file

@ -0,0 +1,8 @@
[Desktop Entry]
Name=SweeCrypt GTK
Comment=Simple and fun cipher
Exec=sweecrypt-gtk
Type=Application
Icon=sweecrypt
Categories=Utility;
StartupNotify=false