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