mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-04 03:38:26 +02:00
added try except in most function to help debugging error
This commit is contained in:
parent
e4fa9ba95c
commit
17783d82f5
1 changed files with 99 additions and 95 deletions
|
@ -9,123 +9,127 @@ from .check_update import check_update
|
||||||
from .translate import translate
|
from .translate import translate
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.language = self.get_language()
|
try:
|
||||||
|
self.language = self.get_language()
|
||||||
|
|
||||||
self.root = Tk()
|
self.root = Tk()
|
||||||
self.root.title(self.translate("MKWFaraphel Installateur"))
|
self.root.title(self.translate("MKWFaraphel Installateur"))
|
||||||
self.root.resizable(False, False)
|
self.root.resizable(False, False)
|
||||||
self.root.iconbitmap(bitmap="./icon.ico")
|
self.root.iconbitmap(bitmap="./icon.ico")
|
||||||
|
|
||||||
self.check_update()
|
self.check_update()
|
||||||
self.path_mkwf = None
|
self.path_mkwf = None
|
||||||
|
|
||||||
self.frame_language = Frame(self.root)
|
self.frame_language = Frame(self.root)
|
||||||
self.frame_language.grid(row=1, column=1, sticky="E")
|
self.frame_language.grid(row=1, column=1, sticky="E")
|
||||||
|
|
||||||
Label(self.frame_language, text=self.translate("Langage : ")).grid(row=1, column=1)
|
Label(self.frame_language, text=self.translate("Langage : ")).grid(row=1, column=1)
|
||||||
self.listbox_language = ttk.Combobox(self.frame_language, values=["fr", "en"], width=5)
|
self.listbox_language = ttk.Combobox(self.frame_language, values=["fr", "en"], width=5)
|
||||||
self.listbox_language.set(self.language)
|
self.listbox_language.set(self.language)
|
||||||
self.listbox_language.grid(row=1, column=2)
|
self.listbox_language.grid(row=1, column=2)
|
||||||
|
|
||||||
|
|
||||||
self.listbox_language.bind("<<ComboboxSelected>>", lambda x: self.change_language())
|
self.listbox_language.bind("<<ComboboxSelected>>", lambda x: self.change_language())
|
||||||
|
|
||||||
self.frame_game_path = LabelFrame(self.root, text=self.translate("Jeu original"))
|
self.frame_game_path = LabelFrame(self.root, text=self.translate("Jeu original"))
|
||||||
self.frame_game_path.grid(row=2, column=1)
|
self.frame_game_path.grid(row=2, column=1)
|
||||||
|
|
||||||
entry_game_path = Entry(self.frame_game_path, width=50)
|
entry_game_path = Entry(self.frame_game_path, width=50)
|
||||||
entry_game_path.grid(row=1, column=1, sticky="NEWS")
|
entry_game_path.grid(row=1, column=1, sticky="NEWS")
|
||||||
|
|
||||||
def select_path():
|
def select_path():
|
||||||
path = filedialog.askopenfilename(filetypes=((self.translate("Jeu Wii"),
|
path = filedialog.askopenfilename(filetypes=((self.translate("Jeu Wii"),
|
||||||
r"*.iso *.wbfs main.dol *.wia *.ciso"),))
|
r"*.iso *.wbfs main.dol *.wia *.ciso"),))
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
entry_game_path.delete(0, END)
|
entry_game_path.delete(0, END)
|
||||||
entry_game_path.insert(0, path)
|
entry_game_path.insert(0, path)
|
||||||
|
|
||||||
Button(self.frame_game_path, text="...", relief=RIDGE, command=select_path).grid(row=1, column=2, sticky="NEWS")
|
Button(self.frame_game_path, text="...", relief=RIDGE, command=select_path).grid(row=1, column=2, sticky="NEWS")
|
||||||
|
|
||||||
self.frame_game_path_action = Frame(self.frame_game_path) # Action Extraire & Tout faire
|
self.frame_game_path_action = Frame(self.frame_game_path) # Action Extraire & Tout faire
|
||||||
self.frame_game_path_action.grid(row=2, column=1, columnspan=2, sticky="NEWS")
|
self.frame_game_path_action.grid(row=2, column=1, columnspan=2, sticky="NEWS")
|
||||||
self.frame_game_path_action.columnconfigure(1, weight=1)
|
self.frame_game_path_action.columnconfigure(1, weight=1)
|
||||||
|
|
||||||
def use_path():
|
def use_path():
|
||||||
def func():
|
def func():
|
||||||
self.frame_action.grid_forget()
|
self.frame_action.grid_forget()
|
||||||
path = entry_game_path.get()
|
path = entry_game_path.get()
|
||||||
if not (os.path.exists(path)):
|
if not (os.path.exists(path)):
|
||||||
messagebox.showerror(self.translate("Erreur"), self.translate("Le chemin de fichier est invalide"))
|
messagebox.showerror(self.translate("Erreur"), self.translate("Le chemin de fichier est invalide"))
|
||||||
return
|
return
|
||||||
|
|
||||||
extension = get_extension(path)
|
extension = get_extension(path)
|
||||||
if extension.upper() == "DOL":
|
if extension.upper() == "DOL":
|
||||||
if messagebox.askyesno(self.translate("Attention"),
|
if messagebox.askyesno(self.translate("Attention"),
|
||||||
self.translate("Ce dossier sera écrasé si vous installer le mod !\n" +
|
self.translate("Ce dossier sera écrasé si vous installer le mod !\n" +
|
||||||
"Êtes-vous sûr de vouloir l'utiliser ?")):
|
"Êtes-vous sûr de vouloir l'utiliser ?")):
|
||||||
self.path_mkwf = os.path.realpath(path + "/../../")
|
self.path_mkwf = os.path.realpath(path + "/../../")
|
||||||
elif extension.upper() in ["ISO", "WBFS", "WIA", "CSIO"]:
|
elif extension.upper() in ["ISO", "WBFS", "WIA", "CSIO"]:
|
||||||
self.path_mkwf, i = os.path.realpath(path + "/../MKWiiFaraphel"), 1
|
self.path_mkwf, i = os.path.realpath(path + "/../MKWiiFaraphel"), 1
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if not (os.path.exists(self.path_mkwf)): break
|
if not (os.path.exists(self.path_mkwf)): break
|
||||||
self.path_mkwf, i = os.path.realpath(path + f"/../MKWiiFaraphel ({i})"), i + 1
|
self.path_mkwf, i = os.path.realpath(path + f"/../MKWiiFaraphel ({i})"), i + 1
|
||||||
|
|
||||||
self.Progress(show=True, indeter=True, statut=self.translate("Extraction du jeu..."))
|
self.Progress(show=True, indeter=True, statut=self.translate("Extraction du jeu..."))
|
||||||
subprocess.call(["./tools/wit/wit", "EXTRACT", path, "--DEST", self.path_mkwf]
|
subprocess.call(["./tools/wit/wit", "EXTRACT", path, "--DEST", self.path_mkwf]
|
||||||
, creationflags=CREATE_NO_WINDOW)
|
, creationflags=CREATE_NO_WINDOW)
|
||||||
|
self.Progress(show=False)
|
||||||
|
|
||||||
|
else:
|
||||||
|
messagebox.showerror(self.translate("Erreur"), self.translate("Le type de fichier n'est pas reconnu"))
|
||||||
|
self.Progress(show=False)
|
||||||
|
return
|
||||||
|
|
||||||
|
if os.path.exists(self.path_mkwf + "/files/rel/lecode-PAL.bin"):
|
||||||
|
messagebox.showwarning(self.translate("Attention"),
|
||||||
|
self.translate("Cette ROM est déjà moddé, " +
|
||||||
|
"il est déconseillé de l'utiliser pour installer le mod"))
|
||||||
|
|
||||||
|
self.frame_action.grid(row=3, column=1, sticky="NEWS")
|
||||||
self.Progress(show=False)
|
self.Progress(show=False)
|
||||||
|
|
||||||
else:
|
|
||||||
messagebox.showerror(self.translate("Erreur"), self.translate("Le type de fichier n'est pas reconnu"))
|
|
||||||
self.Progress(show=False)
|
|
||||||
return
|
|
||||||
|
|
||||||
if os.path.exists(self.path_mkwf + "/files/rel/lecode-PAL.bin"):
|
|
||||||
messagebox.showwarning(self.translate("Attention"),
|
|
||||||
self.translate("Cette ROM est déjà moddé, " +
|
|
||||||
"il est déconseillé de l'utiliser pour installer le mod"))
|
|
||||||
|
|
||||||
self.frame_action.grid(row=3, column=1, sticky="NEWS")
|
|
||||||
self.Progress(show=False)
|
|
||||||
|
|
||||||
t = Thread(target=func)
|
|
||||||
t.setDaemon(True)
|
|
||||||
t.start()
|
|
||||||
return t
|
|
||||||
|
|
||||||
self.button_game_extract = Button(self.frame_game_path_action, text=self.translate("Extraire le fichier"),
|
|
||||||
relief=RIDGE, command=use_path)
|
|
||||||
self.button_game_extract.grid(row=1, column=1, sticky="NEWS")
|
|
||||||
|
|
||||||
def do_everything():
|
|
||||||
def func():
|
|
||||||
use_path().join()
|
|
||||||
self.patch_file().join()
|
|
||||||
self.install_mod().join()
|
|
||||||
|
|
||||||
if messagebox.askyesno(self.translate("Fonctionnalité expérimentale"),
|
|
||||||
self.translate("Cette action va extraire / utiliser la ROM sélectionné,"
|
|
||||||
" préparer les fichiers et installer le mod. Voulez-vous continuer ?")):
|
|
||||||
t = Thread(target=func)
|
t = Thread(target=func)
|
||||||
t.setDaemon(True)
|
t.setDaemon(True)
|
||||||
t.start()
|
t.start()
|
||||||
|
return t
|
||||||
|
|
||||||
self.button_do_everything = Button(self.frame_game_path_action, text=self.translate("Tout faire"),
|
self.button_game_extract = Button(self.frame_game_path_action, text=self.translate("Extraire le fichier"),
|
||||||
relief=RIDGE, command=do_everything)
|
relief=RIDGE, command=use_path)
|
||||||
self.button_do_everything.grid(row=1, column=2, sticky="NEWS")
|
self.button_game_extract.grid(row=1, column=1, sticky="NEWS")
|
||||||
|
|
||||||
|
def do_everything():
|
||||||
|
def func():
|
||||||
|
use_path().join()
|
||||||
|
self.patch_file().join()
|
||||||
|
self.install_mod().join()
|
||||||
|
|
||||||
|
if messagebox.askyesno(self.translate("Fonctionnalité expérimentale"),
|
||||||
|
self.translate("Cette action va extraire / utiliser la ROM sélectionné,"
|
||||||
|
" préparer les fichiers et installer le mod. Voulez-vous continuer ?")):
|
||||||
|
t = Thread(target=func)
|
||||||
|
t.setDaemon(True)
|
||||||
|
t.start()
|
||||||
|
|
||||||
|
self.button_do_everything = Button(self.frame_game_path_action, text=self.translate("Tout faire"),
|
||||||
|
relief=RIDGE, command=do_everything)
|
||||||
|
self.button_do_everything.grid(row=1, column=2, sticky="NEWS")
|
||||||
|
|
||||||
|
|
||||||
self.frame_action = LabelFrame(self.root, text=self.translate("Action"))
|
self.frame_action = LabelFrame(self.root, text=self.translate("Action"))
|
||||||
|
|
||||||
self.button_prepare_file = Button(self.frame_action, text=self.translate("Preparer les fichiers"), relief=RIDGE,
|
self.button_prepare_file = Button(self.frame_action, text=self.translate("Preparer les fichiers"), relief=RIDGE,
|
||||||
command=self.patch_file, width=45)
|
command=self.patch_file, width=45)
|
||||||
self.button_prepare_file.grid(row=1, column=1, columnspan=2, sticky="NEWS")
|
self.button_prepare_file.grid(row=1, column=1, columnspan=2, sticky="NEWS")
|
||||||
self.button_install_mod = Button(self.frame_action, text=self.translate("Installer le mod"), relief=RIDGE,
|
self.button_install_mod = Button(self.frame_action, text=self.translate("Installer le mod"), relief=RIDGE,
|
||||||
command=self.install_mod, width=35)
|
command=self.install_mod, width=35)
|
||||||
self.listbox_outputformat = ttk.Combobox(self.frame_action, values=[self.translate("Dossier"),
|
self.listbox_outputformat = ttk.Combobox(self.frame_action, values=[self.translate("Dossier"),
|
||||||
"ISO", "WBFS", "CISO"], width=5)
|
"ISO", "WBFS", "CISO"], width=5)
|
||||||
self.listbox_outputformat.set(self.translate("Dossier"))
|
self.listbox_outputformat.set(self.translate("Dossier"))
|
||||||
# Le boutton d'installation du mod n'est affiché qu'après avoir préparer les fichiers
|
# Le boutton d'installation du mod n'est affiché qu'après avoir préparer les fichiers
|
||||||
|
|
||||||
self.progressbar = ttk.Progressbar(self.root)
|
self.progressbar = ttk.Progressbar(self.root)
|
||||||
self.progresslabel = Label(self.root)
|
self.progresslabel = Label(self.root)
|
||||||
|
|
||||||
|
except:
|
||||||
|
self.log_error()
|
||||||
|
|
Loading…
Reference in a new issue