mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-03 19:28:25 +02:00
using load_from_json return self
This commit is contained in:
parent
2096b93540
commit
3f8fad07fd
2 changed files with 9 additions and 3 deletions
|
@ -136,7 +136,7 @@ class CT_Config:
|
||||||
|
|
||||||
return ct_icon
|
return ct_icon
|
||||||
|
|
||||||
def load_ctconfig_file(self, ctconfig_file: str = "./ct_config.json") -> None:
|
def load_ctconfig_file(self, ctconfig_file: str = "./ct_config.json"):
|
||||||
"""
|
"""
|
||||||
load a ctconfig from a json file
|
load a ctconfig from a json file
|
||||||
:param ctconfig_file: path to the ctconfig file
|
:param ctconfig_file: path to the ctconfig file
|
||||||
|
@ -145,7 +145,9 @@ class CT_Config:
|
||||||
ctconfig_json = json.load(f)
|
ctconfig_json = json.load(f)
|
||||||
self.load_ctconfig_json(ctconfig_json)
|
self.load_ctconfig_json(ctconfig_json)
|
||||||
|
|
||||||
def load_ctconfig_json(self, ctconfig_json: dict) -> None:
|
return self
|
||||||
|
|
||||||
|
def load_ctconfig_json(self, ctconfig_json: dict):
|
||||||
"""
|
"""
|
||||||
load ctconfig from a dictionnary
|
load ctconfig from a dictionnary
|
||||||
:param ctconfig_json: json of the ctconfig to load
|
:param ctconfig_json: json of the ctconfig to load
|
||||||
|
@ -184,6 +186,8 @@ class CT_Config:
|
||||||
for param in ["region", "cheat_region", "tags_color", "prefix_list", "suffix_list", "tag_retro"]:
|
for param in ["region", "cheat_region", "tags_color", "prefix_list", "suffix_list", "tag_retro"]:
|
||||||
setattr(self, param, ctconfig_json.get(param))
|
setattr(self, param, ctconfig_json.get(param))
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
def search_tracks(self, values_list=False, not_value=False, only_unordered_track=False, **kwargs) -> list:
|
def search_tracks(self, values_list=False, not_value=False, only_unordered_track=False, **kwargs) -> list:
|
||||||
"""
|
"""
|
||||||
:param only_unordered_track: only search in unordered track
|
:param only_unordered_track: only search in unordered track
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Cup:
|
||||||
ctfile_cup += track.get_ctfile(*args, **kwargs)
|
ctfile_cup += track.get_ctfile(*args, **kwargs)
|
||||||
return ctfile_cup
|
return ctfile_cup
|
||||||
|
|
||||||
def load_from_json(self, cup: dict) -> None:
|
def load_from_json(self, cup: dict):
|
||||||
"""
|
"""
|
||||||
load the cup from a dictionnary
|
load the cup from a dictionnary
|
||||||
:param cup: dictionnary cup
|
:param cup: dictionnary cup
|
||||||
|
@ -54,3 +54,5 @@ class Cup:
|
||||||
self.tracks[int(i)].load_from_json(track_json)
|
self.tracks[int(i)].load_from_json(track_json)
|
||||||
else:
|
else:
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
Loading…
Reference in a new issue