Skip to content

Commit

Permalink
fix(gui.windows): reformat code with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
maugde committed Sep 10, 2024
1 parent e27b723 commit 1962e44
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/antares_web_installer/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def create_shortcuts(self):
desktop_path = Path(get_desktop())

logger.info("Generating server shortcut on desktop...")
name, ext = SHORTCUT_NAMES[os.name].split('.')
name, ext = SHORTCUT_NAMES[os.name].split(".")
new_shortcut_name = f"{name}-{self.version}.{ext}"
shortcut_path = desktop_path.joinpath(new_shortcut_name)

Expand Down Expand Up @@ -294,7 +294,7 @@ def start_server(self):
if nb_attempts == max_attempts:
try:
httpx.get("http://localhost:8080/", timeout=1)
except httpx.ConnectTimeout:
except httpx.ConnectTimeout as e:
logger.error("Impossible to launch Antares Web Server after {nb_attempts} attempts.")
raise InstallError(f"Impossible to launch Antares Web Server after {nb_attempts} attempts: {e}")
time.sleep(5)
Expand Down
6 changes: 3 additions & 3 deletions src/antares_web_installer/gui/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def init_log_file_handler(self):
# initialize file handler logger
def init_console_handler(self, callback):
"""
@param callback:
@return:
"""
Expand All @@ -117,8 +117,8 @@ def run(self) -> None:

def install(self, callback: typing.Callable):
"""
Run App.install method
@param callback: function that is used to update logs
Run App.install method
@param callback: function that is used to update logs
"""
self.init_log_file_handler()
self.logger.debug("file logger initialized.")
Expand Down
9 changes: 7 additions & 2 deletions src/antares_web_installer/gui/widgets/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from antares_web_installer.shortcuts import get_homedir
from .button import CancelBtn, BackBtn, NextBtn, FinishBtn, InstallBtn
from ..mvc import ControllerError

if TYPE_CHECKING:
from antares_web_installer.gui.view import WizardView
Expand Down Expand Up @@ -152,8 +153,12 @@ def browse(self):
title="Choose the target directory",
initialdir=get_homedir(),
)
self.window.set_target_dir(dir_path)
self.target_path.set(dir_path)
try:
self.window.set_target_dir(dir_path)
except ControllerError:
pass
else:
self.target_path.set(dir_path)

def get_next_frame(self):
# Lazy import for typing and testing purposes
Expand Down

0 comments on commit 1962e44

Please sign in to comment.