Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
objQRcode
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thorfin89
objQRcode
Commits
2a770013
Commit
2a770013
authored
Jan 01, 2024
by
Thorfin89
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Menu fichiers en cours de codage : 'enregistrer sous' en cours de codage. 'enregistrer' non codé
parent
711eec84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
11 deletions
+46
-11
main.py
main.py
+46
-11
No files found.
main.py
View file @
2a770013
...
@@ -21,18 +21,47 @@ curent_file = ""
...
@@ -21,18 +21,47 @@ curent_file = ""
# ===== FONCTIONS =====
# ===== FONCTIONS =====
def
new_file
():
global
curent_file
curent_file
=
""
# on vide toutes les zones de saisie
ssid_name
.
delete
(
0
,
'end'
)
password
.
delete
(
0
,
'end'
)
text
.
delete
(
0
,
'end'
)
qrcode_label
.
place
(
x
=
400
,
y
=
400
)
# ouverture d'un fichier
# ouverture d'un fichier
def
open_file
():
def
open_file
():
global
curent_file
global
curent_file
file
=
filedialog
.
askopenfilename
(
title
=
"Ouvrir un QRCode au format PNG"
,
defaultextension
=
"png"
,
file
=
filedialog
.
askopenfilename
(
title
=
"Ouvrir un QRCode au format PNG"
,
defaultextension
=
"png"
,
initialdir
=
"./qrcodes"
)
initialdir
=
"./qrcodes"
)
curent_file
=
file
curent_file
=
file
ssid_name
.
delete
(
0
,
'end'
)
password
.
delete
(
0
,
'end'
)
text
.
delete
(
0
,
'end'
)
text
.
delete
(
0
,
'end'
)
text
.
insert
(
0
,
decode
(
file
))
text
.
insert
(
0
,
decode
(
file
))
code
()
code
()
display_qrcode
()
display_qrcode
()
# enregistrer un fichier sous
def
save_as
():
global
curent_file
if
curent_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
)
else
:
messagebox
.
showerror
(
"Erreur"
,
"Le fichier est vide"
)
# lit l'image au format PNG et renvoie le texte
# lit l'image au format PNG et renvoie le texte
def
decode
(
file
):
def
decode
(
file
):
decoder
=
cv2
.
QRCodeDetector
()
decoder
=
cv2
.
QRCodeDetector
()
...
@@ -92,14 +121,20 @@ def transfert():
...
@@ -92,14 +121,20 @@ def transfert():
else
:
else
:
cache
=
""
cache
=
""
# mise à jour du texte à coder
if
(
crypt
!=
"Aucun"
and
pwd
!=
""
)
or
(
crypt
==
"Aucun"
and
password
.
get
()
==
""
):
text
.
delete
(
0
,
'end'
)
code_wifi
=
"WIFI:T:"
+
crypt
+
";S:"
+
ssid
+
";P:"
+
pwd
+
";H:"
+
cache
# mise à jour du texte à coder
text
.
insert
(
0
,
code_wifi
)
text
.
delete
(
0
,
'end'
)
code_wifi
=
"WIFI:T:"
+
crypt
+
";S:"
+
ssid
+
";P:"
+
pwd
+
";H:"
+
cache
text
.
insert
(
0
,
code_wifi
)
# création de l'image du qrcode et affichage
code
()
display_qrcode
()
else
:
messagebox
.
showerror
(
"Erreur"
,
"Il n'y a pas de mot de passe"
)
# création de l'image du qrcode et affichage
code
()
display_qrcode
()
else
:
else
:
messagebox
.
showerror
(
"Erreur"
,
"Saisissez un SSID"
)
messagebox
.
showerror
(
"Erreur"
,
"Saisissez un SSID"
)
...
@@ -167,10 +202,10 @@ menu_general = Menu(root)
...
@@ -167,10 +202,10 @@ menu_general = Menu(root)
menu_fichier
=
Menu
(
menu_general
,
tearoff
=
0
)
menu_fichier
=
Menu
(
menu_general
,
tearoff
=
0
)
menu_general
.
add_cascade
(
label
=
"Fichier"
,
menu
=
menu_fichier
)
menu_general
.
add_cascade
(
label
=
"Fichier"
,
menu
=
menu_fichier
)
# Création des sous menus 'Fichiers'
# Création des sous menus 'Fichiers'
menu_fichier
.
add_command
(
label
=
"Nouveau"
)
menu_fichier
.
add_command
(
label
=
"Nouveau"
,
command
=
new_file
)
menu_fichier
.
add_command
(
label
=
"Ouvrir"
,
command
=
open_file
)
menu_fichier
.
add_command
(
label
=
"Ouvrir"
,
command
=
open_file
)
menu_fichier
.
add_command
(
label
=
"Enregistrer"
)
menu_fichier
.
add_command
(
label
=
"Enregistrer"
)
menu_fichier
.
add_command
(
label
=
"Enregistrer sous"
)
menu_fichier
.
add_command
(
label
=
"Enregistrer sous"
,
command
=
save_as
)
menu_fichier
.
add_command
(
label
=
"Quitter"
,
command
=
quit
)
menu_fichier
.
add_command
(
label
=
"Quitter"
,
command
=
quit
)
# Création du menu principal 'Aide'
# Création du menu principal 'Aide'
...
@@ -252,8 +287,8 @@ code_btn = Button(left_frame, text="Créer le Code", bg="#88FF88", command=verif
...
@@ -252,8 +287,8 @@ code_btn = Button(left_frame, text="Créer le Code", bg="#88FF88", command=verif
code_btn
.
place
(
x
=
260
,
y
=
380
,
width
=
100
,
height
=
40
)
code_btn
.
place
(
x
=
260
,
y
=
380
,
width
=
100
,
height
=
40
)
# texte à coder
# texte à coder
text
e
_title
=
Label
(
bottom_frame
,
text
=
'Données à coder :'
,
bg
=
"#CCCCCC"
)
text_title
=
Label
(
bottom_frame
,
text
=
'Données à coder :'
,
bg
=
"#CCCCCC"
)
text
e
_title
.
place
(
x
=
30
,
y
=
0
)
text_title
.
place
(
x
=
30
,
y
=
0
)
text
=
Entry
(
bottom_frame
,
width
=
122
)
text
=
Entry
(
bottom_frame
,
width
=
122
)
text
.
place
(
x
=
30
,
y
=
25
)
text
.
place
(
x
=
30
,
y
=
25
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment