mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-04 03:38:26 +02:00
added and changed some translation, removed delete track after convertion and disable download option, remove track download code
This commit is contained in:
parent
b2bcffdb29
commit
d3673fb64d
5 changed files with 34 additions and 47 deletions
|
@ -69,10 +69,8 @@ class NoGui:
|
||||||
is_dev_version = False
|
is_dev_version = False
|
||||||
button_install_mod = NoButton()
|
button_install_mod = NoButton()
|
||||||
stringvar_game_format = NoVariable()
|
stringvar_game_format = NoVariable()
|
||||||
boolvar_disable_download = NoVariable()
|
|
||||||
intvar_process_track = NoVariable()
|
intvar_process_track = NoVariable()
|
||||||
boolvar_dont_check_track_sha1 = NoVariable()
|
boolvar_dont_check_track_sha1 = NoVariable()
|
||||||
boolvar_del_track_after_conv = NoVariable()
|
|
||||||
|
|
||||||
|
|
||||||
class Game:
|
class Game:
|
||||||
|
@ -553,26 +551,8 @@ class Game:
|
||||||
"""
|
"""
|
||||||
nonlocal error_count, error_max, thread_list
|
nonlocal error_count, error_max, thread_list
|
||||||
|
|
||||||
for _track in [track.file_szs, track.file_wu8]:
|
if os.path.exists(track.file_szs) and os.path.getsize(track.file_szs) < 1000:
|
||||||
if os.path.exists(_track):
|
os.remove(track.file_szs) # File under this size are corrupted
|
||||||
if os.path.getsize(_track) < 1000: # File under this size are corrupted
|
|
||||||
os.remove(_track)
|
|
||||||
|
|
||||||
if not self.gui.boolvar_disable_download.get():
|
|
||||||
if not os.path.exists(track.file_wu8):
|
|
||||||
try:
|
|
||||||
track.download_wu8(GITHUB_DEV_BRANCH if self.gui.is_dev_version else GITHUB_MASTER_BRANCH)
|
|
||||||
except CantDownloadTrack:
|
|
||||||
error_count += 1
|
|
||||||
if error_count > error_max: # Too much track wasn't correctly converted
|
|
||||||
messagebox.showerror(
|
|
||||||
self.gui.translate("Error"),
|
|
||||||
self.gui.translate("Too much tracks had a download issue."))
|
|
||||||
raise TooMuchDownloadFailed()
|
|
||||||
else:
|
|
||||||
messagebox.showwarning(self.gui.translate("Warning"),
|
|
||||||
self.gui.translate("Can't download this track !",
|
|
||||||
f" ({error_count} / {error_max})"))
|
|
||||||
|
|
||||||
if not track.check_szs_sha1(): # if sha1 of track's szs is incorrect or track's szs does not exist
|
if not track.check_szs_sha1(): # if sha1 of track's szs is incorrect or track's szs does not exist
|
||||||
if os.path.exists(track.file_wu8):
|
if os.path.exists(track.file_wu8):
|
||||||
|
@ -581,8 +561,6 @@ class Game:
|
||||||
messagebox.showerror(self.gui.translate("Error"),
|
messagebox.showerror(self.gui.translate("Error"),
|
||||||
self.gui.translate("Can't convert track.\nEnable track download and retry."))
|
self.gui.translate("Can't convert track.\nEnable track download and retry."))
|
||||||
raise CantConvertTrack()
|
raise CantConvertTrack()
|
||||||
elif self.gui.boolvar_del_track_after_conv.get():
|
|
||||||
os.remove(track.file_wu8)
|
|
||||||
|
|
||||||
def clean_process() -> int:
|
def clean_process() -> int:
|
||||||
"""
|
"""
|
||||||
|
@ -594,7 +572,6 @@ class Game:
|
||||||
for track_key, thread in thread_list.copy().items():
|
for track_key, thread in thread_list.copy().items():
|
||||||
if not thread.is_alive(): # if conversion ended
|
if not thread.is_alive(): # if conversion ended
|
||||||
thread_list.pop(track_key)
|
thread_list.pop(track_key)
|
||||||
if self.gui.boolvar_del_track_after_conv.get(): os.remove(track.file_wu8)
|
|
||||||
if not (any(thread_list.values())): return 1 # if there is no more process
|
if not (any(thread_list.values())): return 1 # if there is no more process
|
||||||
|
|
||||||
return bool(thread_list)
|
return bool(thread_list)
|
||||||
|
|
|
@ -32,8 +32,6 @@ class Gui:
|
||||||
self.is_dev_version = False # Is this installer version a dev ?
|
self.is_dev_version = False # Is this installer version a dev ?
|
||||||
self.stringvar_language = StringVar(value=self.option.language)
|
self.stringvar_language = StringVar(value=self.option.language)
|
||||||
self.stringvar_game_format = StringVar(value=self.option.format)
|
self.stringvar_game_format = StringVar(value=self.option.format)
|
||||||
self.boolvar_disable_download = BooleanVar(value=self.option.disable_download)
|
|
||||||
self.boolvar_del_track_after_conv = BooleanVar(value=self.option.del_track_after_conv)
|
|
||||||
self.boolvar_dont_check_for_update = BooleanVar(value=self.option.dont_check_for_update)
|
self.boolvar_dont_check_for_update = BooleanVar(value=self.option.dont_check_for_update)
|
||||||
self.intvar_process_track = IntVar(value=self.option.process_track)
|
self.intvar_process_track = IntVar(value=self.option.process_track)
|
||||||
|
|
||||||
|
@ -117,8 +115,6 @@ class Gui:
|
||||||
## INSTALLER PARAMETER
|
## INSTALLER PARAMETER
|
||||||
self.menu_advanced = Menu(self.menu_bar, tearoff=0)
|
self.menu_advanced = Menu(self.menu_bar, tearoff=0)
|
||||||
self.menu_bar.add_cascade(label=self.translate("Advanced"), menu=self.menu_advanced)
|
self.menu_bar.add_cascade(label=self.translate("Advanced"), menu=self.menu_advanced)
|
||||||
self.menu_advanced.add_checkbutton(label=self.translate("Disable downloads"), variable=self.boolvar_disable_download, command=lambda: self.option.edit("disable_download", self.boolvar_disable_download))
|
|
||||||
self.menu_advanced.add_checkbutton(label=self.translate("Delete track after wu8 to szs conversion"), variable=self.boolvar_del_track_after_conv, command=lambda: self.option.edit("del_track_after_conv", self.boolvar_del_track_after_conv))
|
|
||||||
self.menu_advanced.add_checkbutton(label=self.translate("Don't check for update"), variable=self.boolvar_dont_check_for_update, command=lambda: self.option.edit("dont_check_for_update", self.boolvar_dont_check_for_update))
|
self.menu_advanced.add_checkbutton(label=self.translate("Don't check for update"), variable=self.boolvar_dont_check_for_update, command=lambda: self.option.edit("dont_check_for_update", self.boolvar_dont_check_for_update))
|
||||||
self.menu_advanced.add_checkbutton(label=self.translate("Force \"unofficial\" mode"), variable=self.boolvar_force_unofficial_mode)
|
self.menu_advanced.add_checkbutton(label=self.translate("Force \"unofficial\" mode"), variable=self.boolvar_force_unofficial_mode)
|
||||||
|
|
||||||
|
@ -148,7 +144,9 @@ class Gui:
|
||||||
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=f"Apply {label} Folder ({stringvar.get()!r} selected)")
|
self.menu_mystuff.entryconfig(index, label=self.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)
|
||||||
|
@ -341,7 +339,9 @@ class Gui:
|
||||||
translated_text = ""
|
translated_text = ""
|
||||||
for text in texts:
|
for text in texts:
|
||||||
if text in _lang_trad: translated_text += _lang_trad[text]
|
if text in _lang_trad: translated_text += _lang_trad[text]
|
||||||
else: translated_text += text
|
else:
|
||||||
|
print(f"No translation found for ({lang}) {text}")
|
||||||
|
translated_text += text
|
||||||
return translated_text
|
return translated_text
|
||||||
|
|
||||||
def is_using_official_config(self) -> bool:
|
def is_using_official_config(self) -> bool:
|
||||||
|
|
|
@ -5,16 +5,15 @@ from .definition import restart
|
||||||
|
|
||||||
|
|
||||||
class Option:
|
class Option:
|
||||||
def __init__(self):
|
def __init__(self, language: str = "en", format: str = "FST", dont_check_for_update: bool = False,
|
||||||
|
process_track: int = 8):
|
||||||
"""
|
"""
|
||||||
class for Option
|
class for Option
|
||||||
"""
|
"""
|
||||||
self.language = "en"
|
self.language = language
|
||||||
self.format = "FST"
|
self.format = format
|
||||||
self.disable_download = False
|
self.dont_check_for_update = dont_check_for_update
|
||||||
self.del_track_after_conv = False
|
self.process_track = process_track
|
||||||
self.dont_check_for_update = False
|
|
||||||
self.process_track = 8
|
|
||||||
|
|
||||||
def edit(self, option: str, value: any, need_restart: bool = False, gui=None) -> None:
|
def edit(self, option: str, value: any, need_restart: bool = False, gui=None) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -24,7 +24,7 @@ def check_file_sha1(file: str, excepted_sha1: str) -> int:
|
||||||
|
|
||||||
class Track:
|
class Track:
|
||||||
def __init__(self, name: str = "", author: str = "Nintendo", special: str = "T11", music: str = "T11",
|
def __init__(self, name: str = "", author: str = "Nintendo", special: str = "T11", music: str = "T11",
|
||||||
sha1: str = None, since_version: str = None, score: int = 0, warning: int = 0, note: str = "",
|
sha1: str = None, since_version: str = None, score: int = -1, warning: int = 0, note: str = "",
|
||||||
track_wu8_dir: str = "./file/Track-WU8/", track_szs_dir: str = "./file/Track/",
|
track_wu8_dir: str = "./file/Track-WU8/", track_szs_dir: str = "./file/Track/",
|
||||||
track_version: str = None, tags: list = [], *args, **kwargs):
|
track_version: str = None, tags: list = [], *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -166,13 +166,12 @@ class Track:
|
||||||
star_suffix = ""
|
star_suffix = ""
|
||||||
star_text = ""
|
star_text = ""
|
||||||
|
|
||||||
if self.score:
|
if 0 <= self.score <= 5:
|
||||||
if 0 <= self.score <= 5:
|
star_text = f"\\\\x{0xFF10 + self.score:04X}"
|
||||||
star_text = f"\\\\x{0xFF10 + self.score:04X}"
|
star_prefix = "\\\\c{YOR2}" # per default, stars are colored in gold
|
||||||
star_prefix = "\\\\c{YOR2}" # per default, stars are colored in gold
|
star_suffix = "\\\\c{off} "
|
||||||
star_suffix = "\\\\c{off} "
|
if 0 < self.warning <= 3:
|
||||||
if 0 < self.warning <= 3:
|
star_prefix = warning_color[self.warning]
|
||||||
star_prefix = warning_color[self.warning]
|
|
||||||
|
|
||||||
if self.since_version == highlight_version:
|
if self.since_version == highlight_version:
|
||||||
hl_prefix, hl_suffix = "\\\\c{blue1}", "\\\\c{off}"
|
hl_prefix, hl_suffix = "\\\\c{blue1}", "\\\\c{off}"
|
||||||
|
|
|
@ -66,6 +66,18 @@
|
||||||
"Mark all tracks from version": "Marquer toutes les courses de la version",
|
"Mark all tracks from version": "Marquer toutes les courses de la version",
|
||||||
"None": "Aucune",
|
"None": "Aucune",
|
||||||
"MB": "Mo",
|
"MB": "Mo",
|
||||||
"GB": "Go"
|
"GB": "Go",
|
||||||
|
"Format": "Format",
|
||||||
|
"Track configuration": "Configuration des courses",
|
||||||
|
"Select track": "Sélection des courses",
|
||||||
|
"Sort track": "Trier les courses",
|
||||||
|
"Highlight track": "Surligner les courses",
|
||||||
|
"Force \"unofficial\" mode": "Forcer le mode \"non officiel\"",
|
||||||
|
"Use debug mode": "Utiliser le mode de debuggage",
|
||||||
|
"MyStuff": "MyStuff",
|
||||||
|
"Help": "Aide",
|
||||||
|
"Apply": "Appliquer",
|
||||||
|
"Folder": "Dossier",
|
||||||
|
"selected": "sélectionné"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue