change layout a little bit to be more modern

This commit is contained in:
Mylloon 2023-06-01 13:07:52 +02:00
parent 3137708eb2
commit db3f7c6c84
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -31,7 +31,7 @@ class GUI:
self.parent.geometry(f"{x}x{y}+{x_i}+{y_i}")
def _open_file(self) -> None:
def _open_file(self, start: int) -> None:
try:
chemin = askopenfile(
title=f"Choisir un fichier - {self.name}",
@ -47,16 +47,16 @@ class GUI:
exit(1)
else:
if chemin:
return self._analyse(2, chemin.name)
return self._analyse(start, chemin.name)
def _open_directory(self) -> None:
def _open_directory(self, start: int) -> None:
try:
chemin = askdirectory()
except AttributeError:
print("Impossible de trouver le dossier", file=sys.stderr)
exit(1)
else:
return self._analyse(2, chemin)
return self._analyse(start, chemin)
def _main_screen(self) -> None:
"""Écran principal"""
@ -64,13 +64,18 @@ class GUI:
self.parent,
text=f"{self.name} est une application qui permet d'utiliser "
"plus facilement clang-format",
).grid(column=0, row=0, rowspan=2)
).grid(column=0, row=0, columnspan=2)
Button(self.parent, text="Ouvrir un fichier", command=self._open_file).grid(
column=1, row=0
)
start = 2
Button(
self.parent, text="Ouvrir un dossier", command=self._open_directory
self.parent,
text="Ouvrir un fichier",
command=lambda: self._open_file(start),
).grid(column=0, row=1)
Button(
self.parent,
text="Ouvrir un dossier",
command=lambda: self._open_directory(start),
).grid(column=1, row=1)
def _show_info(self, name_err: str, msg: str) -> None:
@ -110,12 +115,12 @@ class GUI:
command=lambda: self._show_info(
error.warning_message, error.warning_content
),
).grid(column=0, row=idx)
).grid(column=0, row=idx, columnspan=2)
idx += 1
else:
Label(
self.parent,
bg="MediumSpringGreen",
text=f"Aucun avertissement trouvé dans {file}.",
).grid(column=0, row=idx)
).grid(column=0, row=idx, columnspan=2)
idx += 1