reformatted some minor thing, added a log_error

This commit is contained in:
Faraphel 2022-01-26 09:37:28 +01:00
parent a82312aabf
commit eafb7a47e9
5 changed files with 28 additions and 16 deletions

View file

@ -423,13 +423,19 @@ class Game:
try: try:
os.makedirs(f"{self.common.ct_config.pack_path}/file/Track-WU8/", exist_ok=True) os.makedirs(f"{self.common.ct_config.pack_path}/file/Track-WU8/", exist_ok=True)
max_step = len(self.common.ct_config.file_process["img_encode"]) + \ max_step = (
len(self.common.ct_config.all_tracks) + \ len(self.common.ct_config.file_process["img_encode"]) +
3 + \ len(self.common.ct_config.all_tracks) +
len("EGFIS") 3 +
len("EGFIS")
)
self.common.gui_main.progress(show=True, indeter=False, statut=self.common.translate("Converting files"), self.common.gui_main.progress(
max=max_step, step=0) show=True,
indeter=False,
statut=self.common.translate("Converting files"),
max=max_step, step=0
)
self.common.gui_main.progress(statut=self.common.translate("Configurating LE-CODE"), add=1) self.common.gui_main.progress(statut=self.common.translate("Configurating LE-CODE"), add=1)
self.common.ct_config.create_ctfile() self.common.ct_config.create_ctfile()
@ -549,7 +555,10 @@ class Game:
:param track: the track that will be patched :param track: the track that will be patched
:return: 0 if no error occured :return: 0 if no error occured
""" """
track.convert_wu8_to_szs() try: track.convert_wu8_to_szs()
except Exception as e:
self.common.log_error()
raise e
def clean_process() -> int: def clean_process() -> int:
""" """

View file

@ -127,7 +127,6 @@ class Main:
self.progressbar = ttk.Progressbar(self.root) self.progressbar = ttk.Progressbar(self.root)
self.progresslabel = Label(self.root) self.progresslabel = Label(self.root)
if self.menu_bar: self.menu_bar.destroy() if self.menu_bar: self.menu_bar.destroy()
self.menu_bar = Menu(self.root) self.menu_bar = Menu(self.root)
self.root.config(menu=self.menu_bar) self.root.config(menu=self.menu_bar)
@ -232,9 +231,10 @@ class Main:
mystuff_dir = filedialog.askdirectory() mystuff_dir = filedialog.askdirectory()
if mystuff_dir: stringvar.set(mystuff_dir) if mystuff_dir: stringvar.set(mystuff_dir)
self.menu_mystuff.entryconfig(index, label=self.common.translate( self.menu_mystuff.entryconfig(
"Apply", " ", label, f" ({stringvar.get()!r} ", "selected", ")") index,
) label=self.common.translate("Apply", " ", label, f" ({stringvar.get()!r} ", "selected", ")")
)
_func(init=True) _func(init=True)
self.menu_mystuff.entryconfig(index, command=_func) self.menu_mystuff.entryconfig(index, command=_func)
@ -254,7 +254,8 @@ class Main:
ctconfig_file=self.get_ctconfig_path_pack(self.stringvar_ctconfig.get()) ctconfig_file=self.get_ctconfig_path_pack(self.stringvar_ctconfig.get())
) )
def get_available_packs(self) -> list: @staticmethod
def get_available_packs() -> list:
available_packs = [] available_packs = []
for pack_ctconfig in glob.glob("./Pack/*/ct_config.json"): for pack_ctconfig in glob.glob("./Pack/*/ct_config.json"):
@ -263,7 +264,8 @@ class Main:
return available_packs return available_packs
def get_ctconfig_path_pack(self, pack_name: str) -> str: @staticmethod
def get_ctconfig_path_pack(pack_name: str) -> str:
return "./Pack/" + pack_name + "/ct_config.json" return "./Pack/" + pack_name + "/ct_config.json"
def check_update(self) -> None: def check_update(self) -> None:

View file

@ -177,7 +177,8 @@ class TrackConfiguration:
command=self.promp_load_from_file command=self.promp_load_from_file
).grid(row=1, column=3, sticky="E") ).grid(row=1, column=3, sticky="E")
def del_frame_track_filter(self, frames_filter: list, index: int = 0): @staticmethod
def del_frame_track_filter(frames_filter: list, index: int = 0):
for elem in frames_filter[index:]: # remove all track filter after this one for elem in frames_filter[index:]: # remove all track filter after this one
elem["frame"].destroy() elem["frame"].destroy()
del frames_filter[index:] del frames_filter[index:]