Compare commits
72 commits
Author | SHA1 | Date | |
---|---|---|---|
247920c234 | |||
06dad0330c | |||
deea8a1bd6 | |||
dcd6df2382 | |||
dacbfd3bb0 | |||
32f51811c5 | |||
337ef45e17 | |||
381c763a3c | |||
a194a1fda2 | |||
496233dcc5 | |||
0059ac99a8 | |||
e4b7a88a60 | |||
336df07b38 | |||
7b63dac8e2 | |||
11821b40ab | |||
ce240ef672 | |||
ec0570fd73 | |||
a9b5c1b797 | |||
d02b81c309 | |||
d41bccb184 | |||
2094d8da73 | |||
4ab01b84e3 | |||
bb856143fa | |||
8bb8e9b238 | |||
d0b16c7ff9 | |||
9aca1b1e06 | |||
3cd1e3418f | |||
3b5b2b9e21 | |||
39a9c20bf1 | |||
da799996ed | |||
cdfa79bccb | |||
4e85024b40 | |||
e13307ca5f | |||
d6cd6ebc3d | |||
49f828ccf0 | |||
f15a14d470 | |||
147ebccfd8 | |||
ac5f5aad23 | |||
286dac970e | |||
564821d707 | |||
162388a1a9 | |||
1f0eb0e79d | |||
00be7e6206 | |||
27f248292e | |||
b499977e44 | |||
39f1c41a60 | |||
2f8ab31ef5 | |||
12c1b69037 | |||
074a7287a1 | |||
6832d425e9 | |||
5671b9bf06 | |||
8d48ff43a9 | |||
5a0aed251b | |||
0b1003b95d | |||
a67db6c024 | |||
63ccda61aa | |||
bf77881cbe | |||
3e9950c3ca | |||
c9a6f9120b | |||
948f7ffa94 | |||
4233c29d58 | |||
80e5b89a61 | |||
27f760cb79 | |||
|
1b656964a7 | ||
f8fe0a55e4 | |||
49596e4626 | |||
831038312b | |||
c7533e8637 | |||
caef7a2026 | |||
4764fdfdeb | |||
edef9018a8 | |||
|
0ea38937f9 |
6 changed files with 161 additions and 87 deletions
58
.forgejo/workflows/build.yml
Normal file
58
.forgejo/workflows/build.yml
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
syntax:
|
||||||
|
name: Check syntax
|
||||||
|
runs-on: alpine
|
||||||
|
steps:
|
||||||
|
- uses: https://git.swee.codes/swee/setup-alpine@main
|
||||||
|
with:
|
||||||
|
additional: python3 libxml2-utils
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Check syntax of Python file
|
||||||
|
run: python3 -m py_compile sweecrypt-gtk.py
|
||||||
|
- name: Check syntax of XML file
|
||||||
|
run: xmllint --format sweecrypt-gtk.ui
|
||||||
|
x11:
|
||||||
|
name: Test the application
|
||||||
|
runs-on: alpine
|
||||||
|
needs: syntax
|
||||||
|
steps:
|
||||||
|
- uses: https://git.swee.codes/swee/setup-alpine@main
|
||||||
|
with:
|
||||||
|
additional: tigervnc py3-gobject3 py3-xdg py3-pip gtk+3.0 apk-gtk3 openbox scrot font-noto-all
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pip install --break-system-packages sweecrypt
|
||||||
|
- name: Set VNC password
|
||||||
|
run: echo -e "sweecrypt\nsweecrypt\n" | vncpasswd
|
||||||
|
- name: Start an X11 server
|
||||||
|
run: USER=root vncserver :5 &
|
||||||
|
- name: Start the app
|
||||||
|
run: DISPLAY=:5 python3 sweecrypt-gtk.py &
|
||||||
|
- name: Wait 5 secs
|
||||||
|
run: sleep 5
|
||||||
|
- name: Take a screenshot
|
||||||
|
run: DISPLAY=:5 scrot screenshot.png
|
||||||
|
- name: Upload screenshot
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: screenshot.png
|
||||||
|
apt:
|
||||||
|
name: Build Debian Package
|
||||||
|
runs-on: docker
|
||||||
|
needs: syntax
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
- name: Generate DEB
|
||||||
|
run: |
|
||||||
|
python3 generate-deb.py
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: sweecrypt-gtk.deb
|
|
@ -1,5 +1,5 @@
|
||||||
Package: sweecrypt-gtk
|
Package: sweecrypt-gtk
|
||||||
Version: 1.0
|
Version: 1.2
|
||||||
Section: utils
|
Section: utils
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Architecture: all
|
Architecture: all
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import os
|
import os
|
||||||
print("Creating Debian package...")
|
print("Creating Debian package...")
|
||||||
if os.name != "posix":
|
|
||||||
print("WARNING: Machine is not running Linux (value of os.name is not \"posix\"), the script will not try to auto-build the .deb file. You might need to manually `chmod 1777` the binary.")
|
|
||||||
file = open("sweecrypt-gtk.py").read().split("\n")
|
file = open("sweecrypt-gtk.py").read().split("\n")
|
||||||
open("dpkg/opt/sweecrypt-gtk.ui",'w').write(open("sweecrypt-gtk.ui").read())
|
open("dpkg/opt/sweecrypt-gtk.ui",'w').write(open("sweecrypt-gtk.ui").read())
|
||||||
file[3] = 'UI_FILE = "/opt/sweecrypt-gtk.ui"'
|
file[3] = 'UI_FILE = "/opt/sweecrypt-gtk.ui"'
|
||||||
|
@ -10,5 +8,4 @@ file.insert(0, "#!/usr/bin/env python3")
|
||||||
file = "\n".join(file)
|
file = "\n".join(file)
|
||||||
open("dpkg/usr/bin/sweecrypt-gtk",'w').write(file)
|
open("dpkg/usr/bin/sweecrypt-gtk",'w').write(file)
|
||||||
os.system("chmod 1777 dpkg/usr/bin/sweecrypt-gtk")
|
os.system("chmod 1777 dpkg/usr/bin/sweecrypt-gtk")
|
||||||
if os.name == "posix":
|
|
||||||
os.system("dpkg-deb --root-owner-group --build dpkg sweecrypt-gtk.deb")
|
os.system("dpkg-deb --root-owner-group --build dpkg sweecrypt-gtk.deb")
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
sweecrypt>=1.0.4
|
||||||
|
PyGObject
|
|
@ -9,25 +9,19 @@ class GUI:
|
||||||
self.builder.connect_signals(self)
|
self.builder.connect_signals(self)
|
||||||
window = self.builder.get_object('window')
|
window = self.builder.get_object('window')
|
||||||
window.show_all()
|
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 on_window_destroy(self, window):Gtk.main_quit()
|
||||||
def encode_toggle(self, encode):self.toggle(True)
|
def toggle(self, checkbox):
|
||||||
def decode_toggle(self, decode):self.toggle(False)
|
checkbox.set_property("label", "Encode" if checkbox.get_property("active") else "Decode")
|
||||||
def start_clicked(self, start):
|
def start_clicked(self, start):
|
||||||
encode = self.builder.get_object('encode').get_property("active")
|
encode = self.builder.get_object('encode').get_property("active")
|
||||||
|
shift = int(self.builder.get_object('shift').get_property("value"))
|
||||||
inputted = self.builder.get_object('text').get_property("text")
|
inputted = self.builder.get_object('text').get_property("text")
|
||||||
if encode:
|
if encode:
|
||||||
self.builder.get_object('text').set_property("text", sc.encrypt(inputted))
|
self.builder.get_object('text').set_property("text", sc.encrypt(inputted, shift))
|
||||||
self.builder.get_object('encode').set_property("active", False)
|
self.builder.get_object('encode').set_property("active", False)
|
||||||
else:
|
else:
|
||||||
self.builder.get_object('text').set_property("text", sc.decrypt(inputted))
|
self.builder.get_object('text').set_property("text", sc.decrypt(inputted, shift))
|
||||||
self.builder.get_object('decode').set_property("active", False)
|
self.builder.get_object('encode').set_property("active", True)
|
||||||
def main():
|
def main():
|
||||||
app = GUI()
|
app = GUI()
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
|
|
|
@ -2,20 +2,11 @@
|
||||||
<!-- Generated with glade 3.40.0 -->
|
<!-- Generated with glade 3.40.0 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.24"/>
|
<requires lib="gtk+" version="3.24"/>
|
||||||
<object class="GtkImage" id="image1">
|
<object class="GtkAdjustment" id="database-shift">
|
||||||
<property name="visible">True</property>
|
<property name="lower">-100</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="upper">100</property>
|
||||||
<property name="icon-name">edit-copy</property>
|
<property name="step-increment">1</property>
|
||||||
</object>
|
<property name="page-increment">10</property>
|
||||||
<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>
|
||||||
<object class="GtkTextBuffer" id="text">
|
<object class="GtkTextBuffer" id="text">
|
||||||
<property name="text" translatable="yes">replace this text with anything
|
<property name="text" translatable="yes">replace this text with anything
|
||||||
|
@ -24,6 +15,8 @@ you want to encode or decode.</property>
|
||||||
<object class="GtkWindow" id="window">
|
<object class="GtkWindow" id="window">
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="title" translatable="yes">SweeCrypt GTK</property>
|
<property name="title" translatable="yes">SweeCrypt GTK</property>
|
||||||
|
<property name="default-width">250</property>
|
||||||
|
<property name="default-height">128</property>
|
||||||
<property name="icon-name">sweecrypt</property>
|
<property name="icon-name">sweecrypt</property>
|
||||||
<signal name="destroy" handler="on_window_destroy" swapped="no"/>
|
<signal name="destroy" handler="on_window_destroy" swapped="no"/>
|
||||||
<child>
|
<child>
|
||||||
|
@ -31,6 +24,11 @@ you want to encode or decode.</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="shadow-type">in</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTextView" id="input">
|
<object class="GtkTextView" id="input">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -38,21 +36,38 @@ you want to encode or decode.</property>
|
||||||
<property name="buffer">text</property>
|
<property name="buffer">text</property>
|
||||||
<property name="monospace">True</property>
|
<property name="monospace">True</property>
|
||||||
</object>
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="encode">
|
<object class="GtkToggleButton" id="encode">
|
||||||
<property name="label" translatable="yes">Encode</property>
|
<property name="label" translatable="yes">Encode</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="image">image1</property>
|
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
<signal name="toggled" handler="encode_toggle" swapped="no"/>
|
<signal name="toggled" handler="toggle" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Database shift: </property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -61,13 +76,36 @@ you want to encode or decode.</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToggleButton" id="decode">
|
<object class="GtkButton" id="star">
|
||||||
<property name="label" translatable="yes">Decode</property>
|
<property name="label" translatable="yes">Start</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="image">image2</property>
|
<signal name="clicked" handler="start_clicked" swapped="no"/>
|
||||||
<signal name="toggled" handler="decode_toggle" swapped="no"/>
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="pack-type">end</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton" id="shift">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">True</property>
|
||||||
|
<property name="caps-lock-warning">False</property>
|
||||||
|
<property name="primary-icon-tooltip-text" translatable="yes">Database shift</property>
|
||||||
|
<property name="adjustment">database-shift</property>
|
||||||
|
<property name="climb-rate">1</property>
|
||||||
|
<property name="numeric">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -75,21 +113,6 @@ you want to encode or decode.</property>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Add table
Reference in a new issue