Skip to content

Commit

Permalink
Feat/Architecture (#8)
Browse files Browse the repository at this point in the history
* Feacture Readme

* update Readme

* mod mineur

* update readme

* change mineur

* maj module version

* update change input

* change architecture
  • Loading branch information
alexcaussades committed Jul 11, 2022
1 parent aa63ce1 commit 5cf34c2
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 30 deletions.
2 changes: 1 addition & 1 deletion assets/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "Stable V-0.0.3"}
{"version": "Stable V-0.0.4"}
12 changes: 8 additions & 4 deletions help.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ def help_funtion():
print("")
print("Avec la commande 'help' vous avez acées a toutes les informations pour utiliser le logiciel ! ")
print("")
print("creat => Crée une fiche de jouer")
print("sr => Recherche la fiche d'un joueur")
print("edit => Edition d'un fichier d'un joueur")
print("exit => Ferme le programe")
print("Recherche and Fiche Players")
print("creat [player]: Crée une fiche de jouer")
print("sr [player]: Recherche la fiche d'un joueur")
print("edit [player]: Edition d'un fichier d'un joueur")
print("")
print("Général Programe")
print("exit: Ferme le programe")
print("version: numéros de version du logiciel")
print("")
55 changes: 37 additions & 18 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
import version
today = date.today()

class bcolors:
OK = '\033[92m' #GREEN
WARNING = '\033[93m' #YELLOW
FAIL = '\033[91m' #RED
RESET = '\033[0m' #RESET COLOR

try:
with open('./assets/config.json') as mon_fichier:
with open('assets/config.json') as mon_fichier:
data = json.load(mon_fichier)
except (FileNotFoundError):
print("Absence de fichier de configration sur le logiciel")
Expand All @@ -34,32 +39,46 @@

try:
while i :

a = input("Que voulez-vous faire {0} ? : ".format(data['name']))

a = a.split()

if (a == "creat"):
req = input("Qu'elle est son nom ? ")
prenom = input("Qu'elle est son prenom ? ")
age = input("Qu'elle est son age ? ")
ville = input("Qu'elle sa ville ? (Si pas disponible (n)) ")
function = input("Qu'elle est sa fonction ? (doc, citoyen, cherif, autre) ")
sr.creatplayer(req, age, prenom, ville, function)
if (a[0] == "creat"):
try:
req = a[1]
prenom = input("Qu'elle est son prenom ? ")
age = input("Qu'elle est son age ? ")
ville = input("Qu'elle sa ville ? (Si pas disponible (n)) ")
function = input("Qu'elle est sa fonction ? (doc, citoyen, cherif, autre) ")
sr.creatplayer(req, age, prenom, ville, function)
except:
print("Manque information player")


if (a == "sr"):
req = input("Qu'elle personne ? ")
sr.player(req)
if (a[0] == "sr"):
try:
req = a[1]
sr.player(req)
except:
print("Manque information player")

if (a == "edit"):
req = input("Qu'elle personne ? ")
information = input("votre nouvelle information ? ")
sr.editplayer(req, information)
if (a[0] == "edit"):
try:
req = a[1]
information = input("votre nouvelle information ? ")
sr.editplayer(req, information)
except:
print("Manque information player")

if (a == 'help'):
if (a[0] == 'help'):
help.help_funtion()

if (a[0] == 'version'):
version.numero_version()

if (a == "exit"):
if (a[0] == "exit"):
quit()

except (KeyboardInterrupt):
except (KeyboardInterrupt):
print(" Fermeture du logiciel")
30 changes: 23 additions & 7 deletions version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,37 @@
from urllib import request, parse
import json
import os
import webbrowser

class bcolors:
OK = '\033[92m' #GREEN
WARNING = '\033[93m' #YELLOW
FAIL = '\033[91m' #RED
RESET = '\033[0m' #RESET COLOR

url = "https://api.github.com/repos/alexcaussades/Follow-RP/releases"

with open('./assets/version.json') as mon_fichier:
data = json.load(mon_fichier)

def versions_serach():
res = request.urlopen(url).read()
page = res.decode("utf8")
y = json.loads(page)

def versions_serach():

if(y[0]['name'] != data["version"]):
print("____________________________________")
print("Une nouvelle version est disponible sur https://github.com/alexcaussades/Follow-RP/releases")
print("")
print("Description de la mise à jour")
print("\n" + y[0]['body'])
print("____________________________________")
print(bcolors.FAIL + "Une nouvelle version est disponible 🔽:"+ bcolors.RESET )
print("⏩ Taper la commande : version")

def numero_version():
print("Vous êtes sur la version : {0}".format(data["version"]))
if(y[0]['name'] != data["version"]):
a = input("mettre à jour ? (y/n)")

if(a == "y"):
repro = request.urlopen(y[0]["url"]).read()
info = repro.decode("utf8")
res = json.loads(info)
webbrowser.open(y[0]["html_url"])

0 comments on commit 5cf34c2

Please sign in to comment.