"do everything button" now use a single thread instead of 3 threads for the 3 parts, allowing the program to stop if an error is raised

This commit is contained in:
Faraphel 2021-08-23 23:52:30 +02:00
parent d71efc6b4e
commit cf8d1bb20e
2 changed files with 12 additions and 11 deletions

View file

@ -148,7 +148,9 @@ class Game:
self.region = region_id_to_name[self.region_ID] if self.region_ID in region_id_to_name else self.region self.region = region_id_to_name[self.region_ID] if self.region_ID in region_id_to_name else self.region
@in_thread @in_thread
def install_mod(self): def install_mod(self): self.nothread_install_mod()
def nothread_install_mod(self):
""" """
Patch the game to install the mod Patch the game to install the mod
""" """
@ -348,7 +350,9 @@ class Game:
finalise(f"./file/Common_R{bmglang}.txt", rbmgcommon) finalise(f"./file/Common_R{bmglang}.txt", rbmgcommon)
@in_thread @in_thread
def patch_file(self): def patch_file(self): self.nothread_patch_file()
def nothread_patch_file(self):
""" """
Prepare all files to install the mod (track, bmg text, descriptive image, ...) Prepare all files to install the mod (track, bmg text, descriptive image, ...)
""" """

View file

@ -108,7 +108,9 @@ class Gui:
self.frame_game_path_action.columnconfigure(1, weight=1) self.frame_game_path_action.columnconfigure(1, weight=1)
@in_thread @in_thread
def use_path(): def use_path(): nothread_use_path()
def nothread_use_path():
self.frame_action.grid_forget() self.frame_action.grid_forget()
try: try:
self.game.set_path(entry_game_path.get()) self.game.set_path(entry_game_path.get())
@ -132,14 +134,9 @@ class Gui:
@in_thread @in_thread
def do_everything(): def do_everything():
use_path().join() nothread_use_path()
self.game.patch_file().join() self.game.nothread_patch_file()
self.game.install_mod().join() self.game.nothread_install_mod()
if messagebox.askyesno(self.translate("Experimental functionality"),
self.translate("This will extract the selected ROM, prepare files and install mod. "
"Do you wish to continue ?")):
do_everything()
self.button_do_everything = Button(self.frame_game_path_action, text=self.translate("Do everything"), relief=RIDGE, command=do_everything) self.button_do_everything = Button(self.frame_game_path_action, text=self.translate("Do everything"), relief=RIDGE, command=do_everything)
self.button_do_everything.grid(row=1, column=2, sticky="NEWS") self.button_do_everything.grid(row=1, column=2, sticky="NEWS")