fix de la création des fichiers temporaires , changement du theme ctk de blue a green , ajout d'un systeme de suivi de version

master
Zayd Nahli 1 week ago
parent d66645b1b3
commit c33bf7078b

@ -4,7 +4,7 @@ from tkinter import filedialog, messagebox, ttk
import os
import platform
import subprocess
import urllib.request
from src.uml_generator import UMLGenerator
from src.code_analyzer import JavaAnalyzer, CSharpAnalyzer
from src.project_analyzer import ProjectAnalyzer
@ -12,16 +12,16 @@ from src.readme_generator import ReadmeGenerator
from src.preview_window import PreviewWindow
class UMLGeneratorApp(ctk.CTk):
def __init__(self):
def __init__(self, local_version):
super().__init__()
self.title("Générateur UML et Documentation")
self.title(f"CodeMap[{local_version}] - Générateur UML et Documentation")
self.geometry("800x600")
ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("blue")
ctk.set_default_color_theme("green")
self.grid_columnconfigure(0, weight=1)
@ -35,7 +35,7 @@ class UMLGeneratorApp(ctk.CTk):
self.title_label = ctk.CTkLabel(
self.main_frame,
text="Générateur UML et Documentation",
text="CodeMap - Générateur UML et Documentation",
font=("Helvetica", 24, "bold")
)
self.title_label.grid(row=0, column=0, pady=20)
@ -325,8 +325,7 @@ class UMLGeneratorApp(ctk.CTk):
from src.uml_generator import UMLGenerator
import tempfile
temp_dir = tempfile.mkdtemp()
temp_dir = tempfile.gettempdir()
generator = UMLGenerator()
temp_diagram = generator.generate_class_diagram(classes, temp_dir)
@ -540,5 +539,19 @@ class UMLGeneratorApp(ctk.CTk):
print(f'Generating README for: {project_title} - {project_description}')
if __name__ == "__main__":
app = UMLGeneratorApp()
url = 'https://codefirst.iut.uca.fr/git/zayd.nahli/CodeMap/raw/branch/master/version/version.txt'
with urllib.request.urlopen(url) as response:
remote_version = response.read().decode().strip()
local_version = "1.1.1-beta1"
if local_version != remote_version:
root = tk.Tk()
root.withdraw()
messagebox.showinfo("Mise à jour disponible",
f"Votre version de CodeMap ({local_version}) n'est pas à jour. La version la plus récente est {remote_version}. Veuillez mettre à jour votre application pour profiter de toutes les fonctionnalités.")
app = UMLGeneratorApp(local_version)
app.mainloop()

@ -1,6 +1,7 @@
import os
from plantuml import PlantUML
from plantuml import PlantUMLHTTPError
import tempfile
class UMLGenerator:
def __init__(self):
@ -71,25 +72,16 @@ class UMLGenerator:
uml_content += "@enduml"
uml_temp_file = os.path.join(output_path, "temp_class_diagram.puml")
with open(uml_temp_file, "w", encoding="utf-8") as f:
f.write(uml_content)
png_temp_file = os.path.join(output_path, "temp_class_diagram.png")
try:
self.plantuml.processes_file(uml_temp_file, outfile=png_temp_file)
except PlantUMLHTTPError as e:
error_msg = str(e)
self.log_message(f"❌ ERREUR: {error_msg}")
except Exception as e:
self.log_message(f"❌ ERREUR inattendue: {str(e)}");
output_puml_file = os.path.join(output_path, 'class_diagram.puml')
with open(output_puml_file, 'w', encoding='utf-8') as f:
f.write(uml_content)
png_file = os.path.join(output_path, "class_diagram.png")
self.plantuml.processes_file(uml_temp_file, outfile=png_file)
self.plantuml.processes_file(output_puml_file, outfile=png_file)
return png_file
def generate_documentation(self, classes, output_path):

Loading…
Cancel
Save