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

@ -60,4 +60,4 @@ class ErrorLogger:
messagebox.showerror(
self.common.translate("Error"),
self.common.translate("An error occured", " :", "\n", error, "\n\n")
)
)

View file

@ -423,13 +423,19 @@ class Game:
try:
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"]) + \
len(self.common.ct_config.all_tracks) + \
3 + \
len("EGFIS")
max_step = (
len(self.common.ct_config.file_process["img_encode"]) +
len(self.common.ct_config.all_tracks) +
3 +
len("EGFIS")
)
self.common.gui_main.progress(show=True, indeter=False, statut=self.common.translate("Converting files"),
max=max_step, step=0)
self.common.gui_main.progress(
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.ct_config.create_ctfile()
@ -549,7 +555,10 @@ class Game:
:param track: the track that will be patched
: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:
"""

View file

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

View file

@ -177,7 +177,8 @@ class TrackConfiguration:
command=self.promp_load_from_file
).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
elem["frame"].destroy()
del frames_filter[index:]

View file

@ -237,4 +237,4 @@ class TrackGroup(Track):
for track in self.tracks:
ctfile_group += track.get_ctfile(*args, **kwargs)
return ctfile_group
return ctfile_group