Skip to content

Commit

Permalink
clean: reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
maugde committed Jul 18, 2024
1 parent b03b20c commit 4ef2e5c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/antares_web_installer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def copy_files(self):
except PermissionError as e: # pragma: no cover
relpath = elt_path.relative_to(self.source_dir).as_posix()
raise InstallError(f"Error: Cannot write '{relpath}' in {self.target_dir}: {e}")
except SameFileError as e:
except SameFileError:
# test if current file is the installer
pass

Expand Down
24 changes: 12 additions & 12 deletions src/antares_web_installer/gui/widgets/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,15 @@ def __init__(self, master: tk.Misc, window: "WizardView", index: int, *args, **k

# Progress Bar values
self.current_progress = tk.StringVar(value="Progress: 0%")
ttk.Label(self.body,
textvariable=self.current_progress,
style="Description.TLabel").pack(side="top", fill="x", padx=5)
ttk.Label(self.body, textvariable=self.current_progress, style="Description.TLabel").pack(
side="top", fill="x", padx=5
)

# Logs display
self.current_logs = tk.StringVar(value="")
self.console = ttk.Label(self.body,
textvariable=self.current_logs,
wraplength=window.width,
style="Description.TLabel")
self.console = ttk.Label(
self.body, textvariable=self.current_logs, wraplength=window.width, style="Description.TLabel"
)
self.console.pack(side="top", fill="x", padx=5)

# next btn is initially disabled
Expand All @@ -260,13 +259,13 @@ def progress_update(self, value: float):
def on_active_frame(self, event):
# Lazy import for typing and testing purposes
from antares_web_installer.gui.controller import WizardController

main_logger = logging.getLogger("antares_web_installer.app")

# retrieve app logger
if isinstance(self.window.controller, WizardController):

# redirect logs in the target `tmp` directory
file_logger = logging.FileHandler(self.window.controller.target_dir.joinpath('tmp/web-installer.log'))
file_logger = logging.FileHandler(self.window.controller.target_dir.joinpath("tmp/web-installer.log"))
file_logger.setFormatter(logging.Formatter(FORMAT))
file_logger.setLevel(logging.ERROR)
main_logger.addHandler(file_logger)
Expand All @@ -280,8 +279,9 @@ def on_active_frame(self, event):
thread.start()
else:
main_logger.error(f"Not implemented {type(self.window.controller)}.")
showerror("Error",
"Installer encounters an issue while instantiating controller (code 'NotImplementedError').")
showerror(
"Error", "Installer encounters an issue while instantiating controller (code 'NotImplementedError')."
)
self.window.quit()

def on_installation_complete(self, event):
Expand All @@ -298,7 +298,7 @@ def __init__(self, master: tk.Misc, window: "WizardView", index: int, *args, **k
self.body,
text="The installation was successfully completed. You can now click on the Finish button "
"to close this window.",
style="Description.TLabel"
style="Description.TLabel",
).pack(side="top", fill="x")

self.control_btn = ControlFrame(parent=self, window=window, finish_btn=True)
Expand Down
2 changes: 1 addition & 1 deletion src/antares_web_installer/shortcuts/_win32_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def create_shortcut(
arguments = [arguments] if arguments else []

target_parent, target_name = str(target).rsplit("\\", maxsplit=1)
target_suffix = target_name.split('.')[-1]
target_suffix = target_name.split(".")[-1]
target_name = " ".join(re.findall(r"[A-Z][a-z]+", target_name))
new_target = target_parent + "\\" + target_name + "." + target_suffix

Expand Down

0 comments on commit 4ef2e5c

Please sign in to comment.