# Released under the MIT License. See LICENSE for details.#"""Playlist ui functionality."""from__future__importannotationsimportbascenev1asbs# FIXME: Could change this to be a classmethod of session types?
[docs]classPlaylistTypeVars:"""Defines values for a playlist type (config names to use, etc)."""def__init__(self,sessiontype:type[bs.Session]):frombascenev1import(get_default_teams_playlist,get_default_free_for_all_playlist,)self.sessiontype:type[bs.Session]ifissubclass(sessiontype,bs.DualTeamSession):play_mode_name=bs.Lstr(resource='playModes.teamsText',fallback_resource='teamsText')self.get_default_list_call=get_default_teams_playlistself.session_type_name='bascenev1.DualTeamSession'self.config_name='Team Tournament'self.window_title_name=bs.Lstr(resource='playModes.teamsText',fallback_resource='teamsText')self.sessiontype=bs.DualTeamSessionelifissubclass(sessiontype,bs.FreeForAllSession):play_mode_name=bs.Lstr(resource='playModes.freeForAllText',fallback_resource='freeForAllText',)self.get_default_list_call=get_default_free_for_all_playlistself.session_type_name='bascenev1.FreeForAllSession'self.config_name='Free-for-All'self.window_title_name=bs.Lstr(resource='playModes.freeForAllText',fallback_resource='freeForAllText',)self.sessiontype=bs.FreeForAllSessionelse:raiseRuntimeError(f'Playlist type vars undefined for sessiontype: {sessiontype}')self.default_list_name=bs.Lstr(resource='defaultGameListNameText',subs=[('${PLAYMODE}',play_mode_name)],)self.default_new_list_name=bs.Lstr(resource='defaultNewGameListNameText',subs=[('${PLAYMODE}',play_mode_name)],)