mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-04 19:58:26 +02:00
track highlight functionnality weren't implemented since code rework
This commit is contained in:
parent
cc1ee7374b
commit
53ee294915
4 changed files with 14 additions and 12 deletions
|
@ -9,6 +9,7 @@ from .Track import Track
|
||||||
|
|
||||||
def get_cup_icon(id, font_path: str = "./file/SuperMario256.ttf", cup_icon_dir: str = "./file/cup_icon"):
|
def get_cup_icon(id, font_path: str = "./file/SuperMario256.ttf", cup_icon_dir: str = "./file/cup_icon"):
|
||||||
"""
|
"""
|
||||||
|
:param id:
|
||||||
:param cup_icon_dir: directory to cup icon
|
:param cup_icon_dir: directory to cup icon
|
||||||
:param font_path: path to the font used to generate icon
|
:param font_path: path to the font used to generate icon
|
||||||
:return: cup icon
|
:return: cup icon
|
||||||
|
@ -54,8 +55,9 @@ class CT_Config:
|
||||||
self.all_version.add(track.since_version)
|
self.all_version.add(track.since_version)
|
||||||
self.all_tracks.append(track)
|
self.all_tracks.append(track)
|
||||||
|
|
||||||
def create_ctfile(self, directory="./file/"):
|
def create_ctfile(self, directory="./file/", highlight_version=None):
|
||||||
"""
|
"""
|
||||||
|
:param highlight_version:
|
||||||
:param directory: create CTFILE.txt and RCTFILE.txt in this directory
|
:param directory: create CTFILE.txt and RCTFILE.txt in this directory
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
@ -79,8 +81,8 @@ class CT_Config:
|
||||||
|
|
||||||
# all cups
|
# all cups
|
||||||
for cup in self.ordered_cups + unordered_cups:
|
for cup in self.ordered_cups + unordered_cups:
|
||||||
ctfile.write(cup.get_ctfile_cup(race=False))
|
ctfile.write(cup.get_ctfile_cup(race=False, highlight_version=highlight_version))
|
||||||
rctfile.write(cup.get_ctfile_cup(race=True))
|
rctfile.write(cup.get_ctfile_cup(race=True, highlight_version=highlight_version))
|
||||||
|
|
||||||
def get_cticon(self):
|
def get_cticon(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -18,14 +18,14 @@ class Cup:
|
||||||
]
|
]
|
||||||
self.locked = locked
|
self.locked = locked
|
||||||
|
|
||||||
def get_ctfile_cup(self, race=False):
|
def get_ctfile_cup(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
:param race: is it a text used for Race_*.szs ?
|
:param race: is it a text used for Race_*.szs ?
|
||||||
:return: ctfile definition for the cup
|
:return: ctfile definition for the cup
|
||||||
"""
|
"""
|
||||||
ctfile_cup = f'\nC "{self.name}"\n'
|
ctfile_cup = f'\nC "{self.name}"\n'
|
||||||
for track in self.tracks:
|
for track in self.tracks:
|
||||||
ctfile_cup += track.get_ctfile(race)
|
ctfile_cup += track.get_ctfile(*args, **kwargs)
|
||||||
return ctfile_cup
|
return ctfile_cup
|
||||||
|
|
||||||
def load_from_json(self, cup: dict):
|
def load_from_json(self, cup: dict):
|
||||||
|
|
|
@ -306,7 +306,7 @@ class Game:
|
||||||
self.gui.progress(show=True, indeter=False, statut=self.gui.translate("Converting files"),
|
self.gui.progress(show=True, indeter=False, statut=self.gui.translate("Converting files"),
|
||||||
max=max_step, step=0)
|
max=max_step, step=0)
|
||||||
self.gui.progress(statut=self.gui.translate("Configurating LE-CODE"), add=1)
|
self.gui.progress(statut=self.gui.translate("Configurating LE-CODE"), add=1)
|
||||||
self.ctconfig.create_ctfile()
|
self.ctconfig.create_ctfile(highlight_version=self.gui.stringvar_mark_track_from_version.get())
|
||||||
|
|
||||||
self.gui.progress(statut=self.gui.translate("Creating ct_icon.png"), add=1)
|
self.gui.progress(statut=self.gui.translate("Creating ct_icon.png"), add=1)
|
||||||
ct_icon = self.ctconfig.get_cticon()
|
ct_icon = self.ctconfig.get_cticon()
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Track:
|
||||||
print(f"error {dl.status_code} {self.file_wu8}")
|
print(f"error {dl.status_code} {self.file_wu8}")
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def get_ctfile(self, race=False):
|
def get_ctfile(self, race=False, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
:param race: is it a text used for Race_*.szs ?
|
:param race: is it a text used for Race_*.szs ?
|
||||||
:return: ctfile definition for the track
|
:return: ctfile definition for the track
|
||||||
|
@ -72,20 +72,20 @@ class Track:
|
||||||
if not race:
|
if not race:
|
||||||
ctfile_text += (
|
ctfile_text += (
|
||||||
f'"{self.get_track_name()}"; ' # track path
|
f'"{self.get_track_name()}"; ' # track path
|
||||||
f'"{self.get_track_formatted_name()}"; ' # track text shown ig
|
f'"{self.get_track_formatted_name(*args, **kwargs)}"; ' # track text shown ig
|
||||||
f'"-"\n') # sha1, useless for now.
|
f'"-"\n') # sha1, useless for now.
|
||||||
else:
|
else:
|
||||||
ctfile_text += (
|
ctfile_text += (
|
||||||
f'"-"; ' # track path, not used in Race_*.szs, save a bit of space
|
f'"-"; ' # track path, not used in Race_*.szs, save a bit of space
|
||||||
f'"{self.get_track_formatted_name()}\\n{self.author}"; ' # only in race show author's name
|
f'"{self.get_track_formatted_name(*args, **kwargs)}\\n{self.author}"; ' # only in race show author's name
|
||||||
f'"-"\n' # sha1, useless for now.
|
f'"-"\n' # sha1, useless for now.
|
||||||
)
|
)
|
||||||
|
|
||||||
return ctfile_text
|
return ctfile_text
|
||||||
|
|
||||||
def get_track_formatted_name(self, highlight_track_from_version: str = None):
|
def get_track_formatted_name(self, highlight_version: str = None):
|
||||||
"""
|
"""
|
||||||
:param highlight_track_from_version: if a specific version need to be highlighted.
|
:param highlight_version: if a specific version need to be highlighted.
|
||||||
:return: the name of the track with colored prefix, suffix
|
:return: the name of the track with colored prefix, suffix
|
||||||
"""
|
"""
|
||||||
hl_prefix = ""
|
hl_prefix = ""
|
||||||
|
@ -99,7 +99,7 @@ class Track:
|
||||||
star_text = "★" * self.score + "☆" * (3 - self.score)
|
star_text = "★" * self.score + "☆" * (3 - self.score)
|
||||||
star_text = trackname_color[star_text] + " "
|
star_text = trackname_color[star_text] + " "
|
||||||
|
|
||||||
if self.since_version == highlight_track_from_version:
|
if self.since_version == highlight_version:
|
||||||
hl_prefix, hl_suffix = "\\\\c{blue1}", "\\\\c{off}"
|
hl_prefix, hl_suffix = "\\\\c{blue1}", "\\\\c{off}"
|
||||||
|
|
||||||
if self.prefix in trackname_color:
|
if self.prefix in trackname_color:
|
||||||
|
|
Loading…
Reference in a new issue