diff options
author | Elrondo46 | 2018-12-14 18:30:32 +0100 |
---|---|---|
committer | Elrondo46 | 2018-12-14 18:30:32 +0100 |
commit | 7543671e9bdca5693790f0f6101539554b62c03c (patch) | |
tree | ec034d48a27f4a246dd198f13b6900ffc43eeb76 /amar.py | |
parent | 3958935e6646078d3a2ce90f9b14db40d4ed7868 (diff) | |
download | aur-7543671e9bdca5693790f0f6101539554b62c03c.tar.gz |
Enhance code
Diffstat (limited to 'amar.py')
-rw-r--r-- | amar.py | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -50,20 +50,13 @@ try: except OSError: errorButtons() -if etatamar == 1: - buttonactive.set_label('DESACTIVER') -else: - buttonactive.set_label('ACTIVER') +buttonactive.set_label('DESACTIVER' if etatamar == 1 else 'ACTIVER') configamar = "\n#Do not disable AMAR manually if you use the app\nInclude = /etc/pacman.d/amar.conf\n" -def success1(): +def success(): buttonactive.set_sensitive(True) - buttonactive.set_label('DESACTIVER') - -def success2(): - buttonactive.set_sensitive(True) - buttonactive.set_label('ACTIVER') + buttonactive.set_label('DESACTIVER' if etatamar == 1 else 'ACTIVER') def pressActive(): global etatamar @@ -75,7 +68,7 @@ def pressActive(): os.system("pacman -Syy") etatamar = 1 ecrire.close() - GLib.idle_add(success1) + GLib.idle_add(success) except OSError: GLib.idle_add(errorButtons) else: @@ -91,10 +84,10 @@ def pressActive(): etatamar = 0 f.close() new_f.close() - GLib.idle_add(success2) + GLib.idle_add(success) except OSError: GLib.idle_add(errorButtons) window = builder.get_object("mainWindow") window.show_all() -Gtk.main() +Gtk.main()
\ No newline at end of file |