matrice de routage ajouté | reformatage
This commit is contained in:
56
gui.py
56
gui.py
@@ -68,7 +68,7 @@ class ToolTip:
|
||||
# Fenêtre principale
|
||||
root = tk.Tk()
|
||||
root.title("Analyse Réseau")
|
||||
root.geometry("650x300")
|
||||
root.geometry("650x350")
|
||||
root.resizable(False, False)
|
||||
|
||||
|
||||
@@ -89,7 +89,8 @@ def open_firewall_gui():
|
||||
input_var = tk.StringVar()
|
||||
output_var = tk.StringVar()
|
||||
|
||||
excel_var = tk.BooleanVar()
|
||||
matrice_flux = tk.BooleanVar()
|
||||
matrice_routage = tk.BooleanVar()
|
||||
|
||||
def browse_input():
|
||||
fw_type = firewall_var.get()
|
||||
@@ -114,17 +115,24 @@ def open_firewall_gui():
|
||||
|
||||
if output_var.get():
|
||||
f_json = os.path.join(OUTPUT_DIR, f"{fw}_{output_var.get()}.json")
|
||||
f_excel = os.path.join(OUTPUT_DIR, f"matrice_{fw}_{output_var.get()}.xlsx")
|
||||
f_flux = os.path.join(OUTPUT_DIR, f"matrice_flux_{fw}_{output_var.get()}.xlsx")
|
||||
f_routage = os.path.join(OUTPUT_DIR, f"matrice_routage_{fw}_{output_var.get()}.xlsx")
|
||||
else:
|
||||
dt = datetime.now().strftime("%Y%m%d")
|
||||
f_json = os.path.join(OUTPUT_DIR, f"{fw}_{dt}.json")
|
||||
f_excel = os.path.join(OUTPUT_DIR, f"matrice_{fw}_{dt}.xlsx")
|
||||
|
||||
if not excel_var.get():
|
||||
output_label_var.set("Fichier de sortie :\n" + f_json)
|
||||
else:
|
||||
output_label_var.set("Fichiers de sortie :\n" + f_json + "\n" + f_excel)
|
||||
f_flux = os.path.join(OUTPUT_DIR, f"matrice_flux_{fw}_{dt}.xlsx")
|
||||
f_routage = os.path.join(OUTPUT_DIR, f"matrice_routage_{fw}_{dt}.xlsx")
|
||||
|
||||
if not matrice_flux.get():
|
||||
if not matrice_routage.get():
|
||||
output_label_var.set("Fichier de sortie :\n" + f_json)
|
||||
else:
|
||||
output_label_var.set("Fichiers de sortie :\n" + f_json + "\n" + f_routage)
|
||||
else:
|
||||
if not matrice_routage.get():
|
||||
output_label_var.set("Fichiers de sortie :\n" + f_json + "\n" + f_flux)
|
||||
else:
|
||||
output_label_var.set("Fichiers de sortie :\n" + f_json + "\n" + f_flux + "\n" + f_routage)
|
||||
app.update_idletasks()
|
||||
|
||||
def open_output_folder():
|
||||
@@ -172,8 +180,11 @@ def open_firewall_gui():
|
||||
if output_var.get():
|
||||
cmd.extend(["-o", output_var.get()])
|
||||
|
||||
if excel_var.get():
|
||||
cmd.append("-m")
|
||||
if matrice_flux.get():
|
||||
cmd.append("-f")
|
||||
|
||||
if matrice_routage.get():
|
||||
cmd.append("-r")
|
||||
|
||||
print("Commande exécutée :", " ".join(cmd))
|
||||
print("Dossier courant (cwd) :", FIREWALL_DIR)
|
||||
@@ -274,15 +285,23 @@ def open_firewall_gui():
|
||||
ttk.Checkbutton(
|
||||
app,
|
||||
text="Générer la matrice de flux en Excel",
|
||||
variable=excel_var
|
||||
).pack(anchor="w", padx=10, pady=10)
|
||||
excel_var.set(True)
|
||||
variable=matrice_flux
|
||||
).pack(anchor="w", padx=10, pady=(10, 0))
|
||||
matrice_flux.set(True)
|
||||
|
||||
ttk.Checkbutton(
|
||||
app,
|
||||
text="Générer la matrice de routage en Excel (route statique uniquement)",
|
||||
variable=matrice_routage
|
||||
).pack(anchor="w", padx=10, pady=(0, 10))
|
||||
matrice_routage.set(True)
|
||||
|
||||
output_label_var = tk.StringVar()
|
||||
ttk.Label(app, textvariable=output_label_var).pack(anchor="w", padx=10)
|
||||
firewall_var.trace_add("write", update_output_label)
|
||||
output_var.trace_add("write", update_output_label)
|
||||
excel_var.trace_add("write", update_output_label)
|
||||
matrice_flux.trace_add("write", update_output_label)
|
||||
matrice_routage.trace_add("write", update_output_label)
|
||||
update_output_label()
|
||||
|
||||
ttk.Button(
|
||||
@@ -321,8 +340,9 @@ ttk.Button(
|
||||
|
||||
ttk.Label(
|
||||
root,
|
||||
text="(Mise des données au format normalisé Yang dans un fichier JSON)" \
|
||||
"\n + possibilité de générer une matrice de flux en Excel",
|
||||
text="(Convertir les données au format normalisé Yang dans un fichier JSON)" \
|
||||
"\n + possibilité de générer une matrice de flux en Excel" \
|
||||
"\n + possibilité de générer une matrice de routage en Excel (route statique uniquement)",
|
||||
font=("Arial", 9, "italic"),
|
||||
anchor="center",
|
||||
justify="center"
|
||||
@@ -339,7 +359,7 @@ ttk.Button(
|
||||
|
||||
ttk.Label(
|
||||
root,
|
||||
text="(Mise des données au format normalisé Yang dans un fichier JSON)" \
|
||||
text="(Convertir les données au format normalisé Yang dans un fichier JSON)" \
|
||||
"\n + possibilité de générer un schéma réseau",
|
||||
font=("Arial", 9, "italic"),
|
||||
anchor="center",
|
||||
|
||||
Reference in New Issue
Block a user