UI refresh
All checks were successful
Sanity check / Test Python file (push) Successful in 13s

This commit is contained in:
Nova Cat 2024-12-23 15:15:06 -08:00
parent 1b656964a7
commit 27f760cb79
2 changed files with 53 additions and 80 deletions

View file

@ -9,16 +9,9 @@ class GUI:
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 toggle(self, checkbox):
checkbox.set_property("label", "Encode" if checkbox.get_property("active") else "Decode")
def start_clicked(self, start):
encode = self.builder.get_object('encode').get_property("active")
inputted = self.builder.get_object('text').get_property("text")
@ -27,7 +20,7 @@ class GUI:
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)
self.builder.get_object('encode').set_property("active", True)
def main():
app = GUI()
Gtk.main()

View file

@ -2,21 +2,6 @@
<!-- 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>
@ -53,15 +38,18 @@ you want to encode or decode.</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<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"/>
<signal name="toggled" handler="toggle" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -70,13 +58,20 @@ you want to encode or decode.</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="decode">
<property name="label" translatable="yes">Decode</property>
<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">image2</property>
<signal name="toggled" handler="decode_toggle" swapped="no"/>
<signal name="clicked" handler="start_clicked" 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>
</object>
<packing>
<property name="expand">False</property>
@ -84,21 +79,6 @@ you want to encode or decode.</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>