bauiv1lib.playlist
Playlist ui functionality.
1# Released under the MIT License. See LICENSE for details. 2# 3"""Playlist ui functionality.""" 4 5from __future__ import annotations 6 7import bascenev1 as bs 8 9 10# FIXME: Could change this to be a classmethod of session types? 11class PlaylistTypeVars: 12 """Defines values for a playlist type (config names to use, etc).""" 13 14 def __init__(self, sessiontype: type[bs.Session]): 15 from bascenev1 import ( 16 get_default_teams_playlist, 17 get_default_free_for_all_playlist, 18 ) 19 20 self.sessiontype: type[bs.Session] 21 22 if issubclass(sessiontype, bs.DualTeamSession): 23 play_mode_name = bs.Lstr( 24 resource='playModes.teamsText', fallback_resource='teamsText' 25 ) 26 self.get_default_list_call = get_default_teams_playlist 27 self.session_type_name = 'bascenev1.DualTeamSession' 28 self.config_name = 'Team Tournament' 29 self.window_title_name = bs.Lstr( 30 resource='playModes.teamsText', fallback_resource='teamsText' 31 ) 32 self.sessiontype = bs.DualTeamSession 33 34 elif issubclass(sessiontype, bs.FreeForAllSession): 35 play_mode_name = bs.Lstr( 36 resource='playModes.freeForAllText', 37 fallback_resource='freeForAllText', 38 ) 39 self.get_default_list_call = get_default_free_for_all_playlist 40 self.session_type_name = 'bascenev1.FreeForAllSession' 41 self.config_name = 'Free-for-All' 42 self.window_title_name = bs.Lstr( 43 resource='playModes.freeForAllText', 44 fallback_resource='freeForAllText', 45 ) 46 self.sessiontype = bs.FreeForAllSession 47 48 else: 49 raise RuntimeError( 50 f'Playlist type vars undefined for sessiontype: {sessiontype}' 51 ) 52 self.default_list_name = bs.Lstr( 53 resource='defaultGameListNameText', 54 subs=[('${PLAYMODE}', play_mode_name)], 55 ) 56 self.default_new_list_name = bs.Lstr( 57 resource='defaultNewGameListNameText', 58 subs=[('${PLAYMODE}', play_mode_name)], 59 )
class
PlaylistTypeVars:
12class PlaylistTypeVars: 13 """Defines values for a playlist type (config names to use, etc).""" 14 15 def __init__(self, sessiontype: type[bs.Session]): 16 from bascenev1 import ( 17 get_default_teams_playlist, 18 get_default_free_for_all_playlist, 19 ) 20 21 self.sessiontype: type[bs.Session] 22 23 if issubclass(sessiontype, bs.DualTeamSession): 24 play_mode_name = bs.Lstr( 25 resource='playModes.teamsText', fallback_resource='teamsText' 26 ) 27 self.get_default_list_call = get_default_teams_playlist 28 self.session_type_name = 'bascenev1.DualTeamSession' 29 self.config_name = 'Team Tournament' 30 self.window_title_name = bs.Lstr( 31 resource='playModes.teamsText', fallback_resource='teamsText' 32 ) 33 self.sessiontype = bs.DualTeamSession 34 35 elif issubclass(sessiontype, bs.FreeForAllSession): 36 play_mode_name = bs.Lstr( 37 resource='playModes.freeForAllText', 38 fallback_resource='freeForAllText', 39 ) 40 self.get_default_list_call = get_default_free_for_all_playlist 41 self.session_type_name = 'bascenev1.FreeForAllSession' 42 self.config_name = 'Free-for-All' 43 self.window_title_name = bs.Lstr( 44 resource='playModes.freeForAllText', 45 fallback_resource='freeForAllText', 46 ) 47 self.sessiontype = bs.FreeForAllSession 48 49 else: 50 raise RuntimeError( 51 f'Playlist type vars undefined for sessiontype: {sessiontype}' 52 ) 53 self.default_list_name = bs.Lstr( 54 resource='defaultGameListNameText', 55 subs=[('${PLAYMODE}', play_mode_name)], 56 ) 57 self.default_new_list_name = bs.Lstr( 58 resource='defaultNewGameListNameText', 59 subs=[('${PLAYMODE}', play_mode_name)], 60 )
Defines values for a playlist type (config names to use, etc).
PlaylistTypeVars(sessiontype: type[bascenev1.Session])
15 def __init__(self, sessiontype: type[bs.Session]): 16 from bascenev1 import ( 17 get_default_teams_playlist, 18 get_default_free_for_all_playlist, 19 ) 20 21 self.sessiontype: type[bs.Session] 22 23 if issubclass(sessiontype, bs.DualTeamSession): 24 play_mode_name = bs.Lstr( 25 resource='playModes.teamsText', fallback_resource='teamsText' 26 ) 27 self.get_default_list_call = get_default_teams_playlist 28 self.session_type_name = 'bascenev1.DualTeamSession' 29 self.config_name = 'Team Tournament' 30 self.window_title_name = bs.Lstr( 31 resource='playModes.teamsText', fallback_resource='teamsText' 32 ) 33 self.sessiontype = bs.DualTeamSession 34 35 elif issubclass(sessiontype, bs.FreeForAllSession): 36 play_mode_name = bs.Lstr( 37 resource='playModes.freeForAllText', 38 fallback_resource='freeForAllText', 39 ) 40 self.get_default_list_call = get_default_free_for_all_playlist 41 self.session_type_name = 'bascenev1.FreeForAllSession' 42 self.config_name = 'Free-for-All' 43 self.window_title_name = bs.Lstr( 44 resource='playModes.freeForAllText', 45 fallback_resource='freeForAllText', 46 ) 47 self.sessiontype = bs.FreeForAllSession 48 49 else: 50 raise RuntimeError( 51 f'Playlist type vars undefined for sessiontype: {sessiontype}' 52 ) 53 self.default_list_name = bs.Lstr( 54 resource='defaultGameListNameText', 55 subs=[('${PLAYMODE}', play_mode_name)], 56 ) 57 self.default_new_list_name = bs.Lstr( 58 resource='defaultNewGameListNameText', 59 subs=[('${PLAYMODE}', play_mode_name)], 60 )
sessiontype: type[bascenev1.Session]