summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorElrondo462018-12-06 09:07:21 +0100
committerElrondo462018-12-06 09:07:21 +0100
commit987605237cd962ce354d48c2ac952b1ba703870a (patch)
treeb94163e855d8c9c12a19b735212f2ca5504b2ea3
parentcef41ab0d8cf94ad15ffb8405526a4cee48e4a4c (diff)
downloadaur-987605237cd962ce354d48c2ac952b1ba703870a.tar.gz
Amar Installer V2 Beta
-rw-r--r--.SRCINFO12
-rw-r--r--PKGBUILD14
-rw-r--r--amar.glade245
-rw-r--r--amar.py139
-rw-r--r--amarban.pngbin0 -> 22549 bytes
5 files changed, 326 insertions, 84 deletions
diff --git a/.SRCINFO b/.SRCINFO
index cad63cd0ac96..059cf696956d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,22 +1,26 @@
pkgbase = amar-installer
pkgdesc = Install AMAR repository
- pkgver = 1.7.2
+ pkgver = 1.9.9.b1
pkgrel = 1
url = https://www.tuxnvape.fr/
install = amar.install
arch = x86_64
license = GPL3
- depends = tk
- depends = python-pillow
+ depends = python
+ depends = python-gobject
source = amar.py
source = amar.png
source = amar.desktop
source = amar.conf
+ source = amar.glade
+ source = amarban.png
source = org.tnv.amar.policy
- sha256sums = 4fe1b85883adcccccf05e30756d68c60859db18ec760d22f8ea24d78690a4496
+ sha256sums = 64c4230895e40e12c268e6a5a02723e166ebe193a6d46786db82889a0d7de782
sha256sums = 874700067f446dff59f8e4e6c3b14519ca8afdf31742af629343c80002c71376
sha256sums = c5dbfca766050bdbfd36866c1f479ca8039aae80fa8b2847b376c05087d1364c
sha256sums = d8fafeb25a8b2368803565ed62ba147aa38adfe57089fe44125f5e07eea3d21b
+ sha256sums = ce1ef2d94876564ab1c5cdfc8bf95f102fe03c04f545c7e6bbb191cf825c0c66
+ sha256sums = 2edefaa6f3143bc2ac3f6a11d069d2a72fc968e492f8e96a2a7e2c9423a4237a
sha256sums = dcf05a9d8c5cfe2cc23523eaab9bbd30932b3d2c68ad8d38edbdcad372053920
pkgname = amar-installer
diff --git a/PKGBUILD b/PKGBUILD
index 20b4577e8880..50cb00274db8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,31 +1,37 @@
# Maintainer: Elrondo46 TuxnVape <elrond94@hotmail.com>
pkgname=amar-installer
-pkgver=1.7.2
+pkgver=1.9.9.b1
pkgrel=1
pkgdesc="Install AMAR repository"
arch=('x86_64')
license=('GPL3')
url="https://www.tuxnvape.fr/"
-depends=('tk' 'python-pillow')
+depends=("python" "python-gobject")
install=amar.install
source=("amar.py"
"amar.png"
"amar.desktop"
"amar.conf"
+ "amar.glade"
+ "amarban.png"
"org.tnv.amar.policy")
-sha256sums=('4fe1b85883adcccccf05e30756d68c60859db18ec760d22f8ea24d78690a4496'
+sha256sums=('64c4230895e40e12c268e6a5a02723e166ebe193a6d46786db82889a0d7de782'
'874700067f446dff59f8e4e6c3b14519ca8afdf31742af629343c80002c71376'
'c5dbfca766050bdbfd36866c1f479ca8039aae80fa8b2847b376c05087d1364c'
'd8fafeb25a8b2368803565ed62ba147aa38adfe57089fe44125f5e07eea3d21b'
- 'dcf05a9d8c5cfe2cc23523eaab9bbd30932b3d2c68ad8d38edbdcad372053920')
+ 'ce1ef2d94876564ab1c5cdfc8bf95f102fe03c04f545c7e6bbb191cf825c0c66'
+ '2edefaa6f3143bc2ac3f6a11d069d2a72fc968e492f8e96a2a7e2c9423a4237a'
+ 'dcf05a9d8c5cfe2cc23523eaab9bbd30932b3d2c68ad8d38edbdcad372053920')
package() {
install -Dm644 "amar.desktop" "${pkgdir}/usr/share/applications/amar.desktop"
install -Dm644 "amar.py" "${pkgdir}/usr/bin/amar.py"
install -Dm644 "amar.png" "${pkgdir}/usr/share/icons/amar.png"
install -Dm644 "amar.conf" "${pkgdir}/etc/pacman.d/amar.conf"
+ install -Dm644 "amar.glade" "${pkgdir}/usr/share/amar/amar.glade"
+ install -Dm644 "amarban.png" "${pkgdir}/usr/share/amar/amarban.png"
install -Dm644 "org.tnv.amar.policy" "${pkgdir}/usr/share/polkit-1/actions/org.tnv.amar.policy"
}
diff --git a/amar.glade b/amar.glade
new file mode 100644
index 000000000000..64d306904312
--- /dev/null
+++ b/amar.glade
@@ -0,0 +1,245 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface>
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkWindow" id="mainWindow">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Installateur du dépot AMAR</property>
+ <property name="resizable">False</property>
+ <property name="icon">../../../../usr/share/icons/amar.png</property>
+ <signal name="destroy" handler="onDestroy" swapped="no"/>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="orientation">vertical</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkButton" id="buttonDesactive">
+ <property name="label" translatable="yes">DESACTIVER</property>
+ <property name="width_request">250</property>
+ <property name="height_request">40</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">center</property>
+ <signal name="clicked" handler="onClickDesactive" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">5</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="buttonActive">
+ <property name="label" translatable="yes">ACTIVER</property>
+ <property name="width_request">250</property>
+ <property name="height_request">40</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">center</property>
+ <property name="valign">end</property>
+ <property name="margin_top">9</property>
+ <signal name="clicked" handler="onClickActive" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">5</property>
+ <property name="width">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="amarfinalstate">
+ <property name="width_request">300</property>
+ <property name="height_request">40</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">start</property>
+ <property name="label" translatable="yes">label</property>
+ </object>
+ <packing>
+ <property name="left_attach">5</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">23</property>
+ <property name="margin_right">47</property>
+ <property name="margin_top">9</property>
+ <property name="label" translatable="yes">Le dépôt AMAR (Arch/Manjaro Alternate Repository) est un
+dépôt tiers donnant accès à des logiciels supplémentaires
+non-accessibles via les dépôts officiels.
+
+Ce dépôt a été créé afin de pouvoir donner accès simplement à
+des logiciels dont l'installation via AUR est problématique ou des logiciels qui ne
+ concernent que Manjaro et qui sont expulsés d'AUR pour cette raison</property>
+ <property name="justify">center</property>
+ <attributes>
+ <attribute name="foreground" value="#757550507b7b"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">5</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="pixbuf">../../../../usr/share/amar/amarban.png</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="width">5</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/amar.py b/amar.py
index 46586a8c46b1..b193abf89650 100644
--- a/amar.py
+++ b/amar.py
@@ -1,63 +1,75 @@
-#!usr/bin/env/ python
-# coding: utf-8
-"""
-Projet AMAR
-Remerciements : Baba, Fredo, Rhylx, Francky, hRF, Pepito...
-Date : 14 Oct 2K17,
- 1.0.1 : 19 Nov 2017
-version : 1.0.1
-gksudo -s python amar.py
-"""
+#!/usr/bin/python
+#Created by Baoréla alias..... SOON
+#Old parts of code Fredo, Rhylx, Francky, hRF, Pepito
-import os
import sys
-from PIL import Image
-import subprocess
-from tkinter import *
+import os
+import gi
+gi.require_version('Gtk', '3.0')
+from gi.repository import Gtk
-if sys.version_info[0] == 3:
- from tkinter import messagebox
-else:
- import tkMessageBox as messagebox
+class Handler:
+ def onDestroy(self, *args):
+ Gtk.main_quit()
+
+ def onClickActive(self, button):
+ pressActive()
+ Gtk.main()
+ def onClickDesactive(self, button):
+ pressDesactive()
+ Gtk.main()
+
+amarpath = "/usr/share/amar/amar.glade"
+builder = Gtk.Builder()
+builder.add_from_file(amarpath)
+builder.connect_signals(Handler())
-os.system("xrdb -load /dev/null") #chargement des données avec xrdb
+os.system("xrdb -load /dev/null")
pacmanfichier = "/etc/pacman.conf"
+amarfinalstate = builder.get_object("amarfinalstate")
+buttonactive = builder.get_object("buttonActive")
+buttondesactive = builder.get_object("buttonDesactive")
try:
- #On suppose d'abord qu'AMAR est désactivé. On met donc etatamar = 0 au départ.
etatamar = 0
- with open(pacmanfichier, 'r') as searchfile:
- for line in searchfile:
- #Si la chaîne '[AMAR]' est écrit quelque part dans pacman.conf, alors le dépôt est activé et on met etatamar = 1.
- if 'amar.conf' in line:
- etatamar = 1
+ searchfile = open(pacmanfichier, "r")
+ for line in searchfile:
+ if "amar.conf" in line:
+ etatamar = 1
searchfile.close()
+
except OSError:
print("pacman.conf non acessible, donnez le chemin vers votre fichier")
sys.exit(1)
configamar = "\n#Do not disable AMAR manually if you use the app\nInclude = /etc/pacman.d/amar.conf\n"
-def pressA():
- A.config(state=DISABLED)
- B.config(state=ACTIVE)
+def errorButtons():
+
+ dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, "ERREUR")
+ dialog.format_secondary_text("Fichier pacman.conf non accessible en écriture\nVérifiez vos droit et relancer"
+ " le script\nVérifier aussi que vous ne faite une mise à jours en même temps")
+ dialog.run()
+ dialog.destroy()
+
+def pressActive():
+ buttonactive.set_sensitive(False)
+ buttondesactive.set_sensitive(True)
try:
with open(pacmanfichier, "a") as ecrire:
ecrire.write(configamar)
ecrire.close()
- os.system("sudo pacman -Syy")
- INFO.config(text="Actif", fg="green") # on active le depot AMAR, donc on ecrit sur le fichier.
+ os.system("pacman -Syy")
+ amarfinalstate.set_markup('<span foreground="blue" face="sans">ACTIF</span>')
etatamar = 1
ecrire.close()
except OSError:
- messagebox.showerror("Erreur", "Ficher pacman.conf non accessible en écrture\nVérifier vos droit et relancer"
- " le script\nVérifier aussi que vous ne faite une mise à jours en même temps")
-
+ errorButtons()
-def pressB():
- A.config(state=ACTIVE)
- B.config(state=DISABLED)
+def pressDesactive():
+ buttonactive.set_sensitive(True)
+ buttondesactive.set_sensitive(False)
try:
with open((pacmanfichier), "r") as f:
lines = f.readlines()
@@ -66,54 +78,29 @@ def pressB():
with open((pacmanfichier), "w") as new_f:
for line in lines:
new_f.write(line)
- os.system ("sudo pacman -Syy")
- INFO.config(text="Inactif", fg="red") # on active le depot AMAR, donc on ecrit sur le fichier.
+ os.system ("pacman -Syy")
+ amarfinalstate.set_markup('<span foreground="red" face="sans">INACTIF</span>')
etatamar = 0
f.close()
new_f.close()
except OSError:
- messagebox.showerror("Erreur", "Ficher pacman.conf non accessible en écrture\nVérifier vos droit et relancer"
- " le script\nVérifier aussi que vous ne faite une mise à jours en même temps")
-
-
-win = Tk()
-win.title("TNV A.M.A.R - Configuration")
-win.geometry("620x280")
-tux = PhotoImage(file="/usr/share/icons/amar.png") # lien vers l'icone de la fenetre
-win.tk.call('wm', 'iconphoto', win._w, tux) # application de la fenetre
+ errorButtons()
-TEXTE = Label(win, text='TNV AMAR', fg="blue")
-TEXTE2 = Label(win, text="Le dépôt AMAR (Arch/Manjaro Alternate Repository) est un dépôt tiers donnant\n"
- "accès à des logiciels supplémentaires non-accessibles via les dépôts officiels."
- "\n\nCe dépôt a été créé afin de pouvoir donner accès simplement à des logiciels dont"
- " l'installation\nvia AUR est problématique ou des logiciels qui ne concernent que"
- " Manjaro\net qui sont expulsés d'AUR pour cette raison.", fg="purple")
-TEXTE.pack(side=TOP, padx=5, pady=3) # Titre de l'application de texte
-TEXTE2.pack(side=TOP, padx=5, pady=10) # Titre de l'application de texte
-A = Button(win, text='ACTIVER', height=2, width=30, command=pressA)
-B = Button(win, text='DESACTIVER', height=2, width=30, command=pressB)
-
-INFO = Label(win, text='', fg="black") # Informations qui changent en fonction du bouton appuyé par l'utilisateur
-MESSAGE = Label(win, text='ETAT DU DEPÔT', fg="blue")
-
-INFO.pack(side=BOTTOM) # on ferme les boutons en décidant de leur amplacement
-MESSAGE.pack(side=BOTTOM)
-
-if etatamar:
- A.pack()
- A.config(state=DISABLED)
- B.pack()
- B.config(state=ACTIVE)
+print(etatamar)
+if etatamar == 0:
+ buttonactive.set_sensitive(True)
+ buttondesactive.set_sensitive(False)
else:
- A.pack()
- A.config(state=ACTIVE)
- B.pack()
- B.config(state=DISABLED)
+ buttondesactive.set_sensitive(True)
+ buttonactive.set_sensitive(False)
if etatamar == 0:
- INFO.config(text="Inactif", fg="red") # on active le depot AMAR, donc on ecrit sur le fichier.
+ amarfinalstate.set_markup('<span foreground="red" face="sans">INACTIF</span>') # on active le depot AMAR, donc on ecrit sur le fichier.
else:
- INFO.config(text="Actif", fg="green") # on active le depot AMAR, donc on ecrit sur le fichier.
+ amarfinalstate.set_markup('<span foreground="blue" face="sans">ACTIF</span>') # on active le depot AMAR, donc on ecrit sur le fichier.
+
+window = builder.get_object("mainWindow")
+window.show_all()
-win.mainloop()
+Gtk.main() \ No newline at end of file
diff --git a/amarban.png b/amarban.png
new file mode 100644
index 000000000000..c6c1c68567bc
--- /dev/null
+++ b/amarban.png
Binary files differ