Commit d1971a78 authored by Thorfin89's avatar Thorfin89

Toutes les fonctions de gestion des fichiers sont opérationnelles. Mise à jour du README.

parent ad47beb0
# objQRCode
![objQRCode-02](README.assets/objQRCode-02.png)
**objQRCode** est un utilitaire pour créer des QRCode écrit en python.
C'est en fait une interface graphique pour **qrcode** (https://pypi.org/project/qrcode/) sous python.
L'application est en cours de développement.
Toute les fonctions sont opérationnelles :
- ouverture d'un QRCode au format PNG
- décodage de l'image
- codage au format PNG d'un texte, une url
- codage d'un accès WIFI
- choix des couleurs (points et fond)
- taille du QRCode
- épaisseur de la bordure
- enregistrement de l'image au format PNG
Il reste quelles petites améliorations
à faire, tant fonctionnelles qu'esthétiques,
voire quelques fonctions supplémentaires à ajouter.
## Paquets à installer :
......@@ -37,4 +51,3 @@ WIFI:T:*cryptage(nopass, WEP, WAPA)*;S:ssid;P:*motdepasse*;H:*caché(true)*
### qrcode - python
- https://pypi.org/project/qrcode/
......@@ -16,14 +16,14 @@ from PIL import Image
fg_color = "#000000"
bg_color = "#FFFFFF"
version = 3
curent_file = ""
current_file = "temp.png"
# ===== FONCTIONS =====
def new_file():
global curent_file
curent_file = ""
global current_file
current_file = "temp.png"
# on vide toutes les zones de saisie
ssid_name.delete(0, 'end')
password.delete(0, 'end')
......@@ -33,11 +33,13 @@ def new_file():
# ouverture d'un fichier
def open_file():
global curent_file
file = filedialog.askopenfilename(title="Ouvrir un QRCode au format PNG", defaultextension="png",
global current_file
file = filedialog.askopenfilename(title="Ouvrir un QRCode au format PNG",
defaultextension="png",
initialdir="./qrcodes")
curent_file = file
current_file = file
# on vide les zones de saisie du WIFI
ssid_name.delete(0, 'end')
password.delete(0, 'end')
text.delete(0, 'end')
......@@ -49,15 +51,14 @@ def open_file():
# enregistrer un fichier sous
def save_as():
global curent_file
if curent_file != "":
global current_file
if current_file != "":
file = filedialog.asksaveasfilename(title="Enregistrer le QRCode au format PNG sous",
filetypes=[("Fichier PNG", "png")],
defaultextension="png",
initialdir="./qrcodes")
curent_file = file
print(curent_file)
current_file = file
code()
else:
messagebox.showerror("Erreur", "Le fichier est vide")
......@@ -148,6 +149,7 @@ def verif_before_code():
def code():
global current_file
global qrcode_img
bs = boxe_size_scale.get()
......@@ -164,17 +166,19 @@ def code():
# création et sauvegarde de l'image du QRCode
img = qr.make_image(fill_color=fg_color, back_color=bg_color)
img.save('qrcode.png')
img.save(current_file)
def display_qrcode():
global qrcode_img
global current_file
# calcul de la taille du QRCode pour le centrer dans la fenêtre
img = Image.open("qrcode.png")
img = Image.open(current_file)
size = img.size
# affichage du QRCode
qrcode_img = PhotoImage(file="qrcode.png")
qrcode_img = PhotoImage(file=current_file)
qrcode_label.config(image=qrcode_img, bg="white")
qrcode_label.place(x=198 - size[0] // 2, y=198 - size[1] // 2) # centrage
......@@ -201,16 +205,18 @@ menu_general = Menu(root)
# Création du menu principal 'Fichier'
menu_fichier = Menu(menu_general, tearoff=0)
menu_general.add_cascade(label="Fichier", menu=menu_fichier)
# Création des sous menus 'Fichiers'
menu_fichier.add_command(label="Nouveau", command=new_file)
menu_fichier.add_command(label="Ouvrir", command=open_file)
menu_fichier.add_command(label="Enregistrer")
menu_fichier.add_command(label="Enregistrer", command=code)
menu_fichier.add_command(label="Enregistrer sous", command=save_as)
menu_fichier.add_command(label="Quitter", command=quit)
# Création du menu principal 'Aide'
menu_aide = Menu(menu_general, tearoff=0)
menu_general.add_cascade(label="Aide", menu=menu_aide)
# Création des sous menus 'Aide'
menu_aide.add_command(label="Info", command=info)
......@@ -254,16 +260,19 @@ border_size_scale.place(x=180, y=90)
# ===== point d'accès WIFI =====
wifi_title = Label(left_frame, text='CONFIGURATION DU WIFI :', bg="#CCCCCC")
wifi_title.place(x=30, y=175)
# SSID
ssid_name_title = Label(left_frame, text='SSID :', bg="#CCCCCC")
ssid_name_title.place(x=30, y=200)
ssid_name = Entry(left_frame, width=40)
ssid_name.place(x=30, y=225)
# Password
password_title = Label(left_frame, text='Mot de passe :', bg="#CCCCCC")
password_title.place(x=30, y=250)
password = Entry(left_frame, width=40)
password.place(x=30, y=275)
# Cryptage
crypt_title = Label(left_frame, text='Cryptage :', bg="#CCCCCC")
crypt_title.place(x=300, y=200)
......@@ -271,12 +280,14 @@ crypt_list = ["WPA", "WEP", "Aucun"]
crypt_choice = SmartSpinBox(root, entry_type='str', width=8, justify=CENTER,
values=crypt_list, callback=no_password)
crypt_choice.place(x=300, y=225)
# Caché
hide_title = Label(left_frame, text='Caché :', bg="#CCCCCC")
hide_title.place(x=300, y=250)
hide_list = ["NON", "OUI"]
hide_choice = Spinbox(left_frame, values=hide_list, width=8, justify=CENTER)
hide_choice.place(x=300, y=275)
# Transfert du code dans les données à coder
transfert_btn = Button(left_frame, text="Transfert\nvers\ndonnées",
bg="#61AEF9", command=transfert)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment