Skip to content

Commit

Permalink
fix(gui): fix bad import
Browse files Browse the repository at this point in the history
  • Loading branch information
maugde committed Aug 1, 2024
1 parent e49a7d2 commit 04759eb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
7 changes: 5 additions & 2 deletions src/antares_web_installer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import logging
from pathlib import Path

from platformdirs import user_data_dir

from antares_web_installer.shortcuts import get_homedir

TARGET_DIR = Path(get_homedir()).joinpath("AntaresWeb")
SRC_DIR = Path(".")
SRC_DIR = Path("/home/glaudemau/bin/AntaresWeb-ubuntu-v2.17.1")
TARGET_DIR = Path(user_data_dir("AntaresWeb", "RTE"))

logger = logging.getLogger(__name__)
4 changes: 2 additions & 2 deletions src/antares_web_installer/gui/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def __init__(self):
self.thread = None
self.init_file_handler()

def init_model(self) -> WizardModel:
def init_model(self) -> "WizardModel":
"""
Override Controller.init_model
@return: a new WizardModel instance
"""
return WizardModel(self)

def init_view(self) -> WizardView:
def init_view(self) -> "WizardView":
"""
Override Controller.init_view
@return: a new WizardView instance
Expand Down
11 changes: 4 additions & 7 deletions src/antares_web_installer/gui/model.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import dataclasses
import logging
import typing

from pathlib import Path

from platformdirs import user_data_dir

from .mvc import Model, Controller
from antares_web_installer.gui.mvc import Model, Controller
from antares_web_installer import SRC_DIR, TARGET_DIR

logger = logging.getLogger(__name__)

Expand All @@ -25,8 +22,8 @@ class WizardModel(Model):
"""
def __init__(self, controller: Controller):
super().__init__(controller)
self.source_dir = Path("/home/glaudemau/bin/AntaresWeb-ubuntu-v2.17.1") # TODO: To change
self.target_dir = Path(user_data_dir("AntaresWeb", "RTE"))
self.source_dir = SRC_DIR
self.target_dir = TARGET_DIR
self.shortcut = True
self.launch = True

Expand Down
9 changes: 5 additions & 4 deletions src/antares_web_installer/gui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@

import logging
import tkinter as tk
import typing

from collections import OrderedDict
from pathlib import Path
from tkinter import ttk, font
from tkinter.messagebox import showerror, showwarning

from antares_web_installer.gui.mvc import View, ControllerError, ViewError
from antares_web_installer.gui.controller import WizardController
from antares_web_installer.gui.widgets.frame import WelcomeFrame, PathChoicesFrame, OptionChoicesFrame, CongratulationFrame, ProgressFrame
from antares_web_installer.gui.widgets import convert_in_du
if typing.TYPE_CHECKING:
from antares_web_installer.gui.controller import WizardController


logger = logging.getLogger(__name__)


class WizardView(View):
def __init__(self, controller: WizardController):
def __init__(self, controller: "WizardController"):
"""
Installer view.
Expand All @@ -37,7 +39,7 @@ def __init__(self, controller: WizardController):
@param controller: the Installer controller that must be a WizardController
"""
super().__init__(controller)
self.controller: WizardController = controller
self.controller: "WizardController" = controller

# configure window settings
self.title("Antares Web Installer")
Expand Down Expand Up @@ -141,7 +143,6 @@ def raise_error(self, msg):
def raise_warning(self, msg):
showwarning("Warning", msg)


def get_target_dir(self) -> Path:
return self.controller.get_target_dir()

Expand Down

0 comments on commit 04759eb

Please sign in to comment.