bauiv1lib.playlist package

Playlist ui functionality.

class bauiv1lib.playlist.PlaylistTypeVars(sessiontype: type[Session])[source]

Bases: object

Defines values for a playlist type (config names to use, etc).

Submodules

bauiv1lib.playlist.addgame module

Provides a window for selecting a game type to add to a playlist.

class bauiv1lib.playlist.addgame.PlaylistAddGameWindow(editcontroller: PlaylistEditController, transition: str | None = 'in_right', origin_widget: bui.Widget | None = None)[source]

Bases: MainWindow

Window for selecting a game type to add to a playlist.

get_main_window_state() → MainWindowState[source]

Return a WindowState to recreate this specific window.

Used to gracefully return to a window from another window or ui system.

main_window_should_preserve_selection() → bool[source]

Whether this window should auto-save/restore selection.

If enabled, selection will be stored in the window’s shared state. See get_main_window_shared_state_id() for more info about main-window shared-state.

The default value of None results in a warning to explicitly override this (as the implicit default will change from False to True after api 9 support ends).

bauiv1lib.playlist.browserdocui module

The teams/free-for-all playlist browser, as a doc-ui page.

A client-local doc-ui domain: a grid of playlist buttons (map previews and all) plus a small customize button, leading to the play-options popup and the playlist customize browser (both still legacy).

It also serves gather’s private-party hosting in select mode (reached via the play page’s select mode), where confirming a playlist in the popup just records it and heads back to gather.

bauiv1lib.playlist.browserdocui.AnyPlaylistRoute

alias of Playlists

class bauiv1lib.playlist.browserdocui.Customize(kind: SessionKind)[source]

Bases: PlaylistLocalAction

Go to the playlist customize browser.

classmethod get_press_sound() → PressSound[source]

What a button plays when pressed to run this local-action.

Actions that stay on the page click (the default); override to return SWISH for ones that go somewhere (open a window or popup). A press whose action has default_sound off plays nothing either way.

kind: SessionKind
class bauiv1lib.playlist.browserdocui.OpenPlaylist(kind: SessionKind, name: str, select: bool = False)[source]

Bases: PlaylistLocalAction

Show a playlist’s play options.

classmethod get_press_sound() → PressSound[source]

What a button plays when pressed to run this local-action.

Actions that stay on the page click (the default); override to return SWISH for ones that go somewhere (open a window or popup). A press whose action has default_sound off plays nothing either way.

kind: SessionKind
name: str
select: bool = False
class bauiv1lib.playlist.browserdocui.PlaylistBrowserController[source]

Bases: TypedDocUIController[Playlists, OpenPlaylist | Customize]

Doc-ui controller for the playlist browser.

fulfill_route(route: AnyPlaylistRoute) → DocUIResponse[source]

Handle fulfillment for a route.

The type-safe equivalent of fulfill_request(); the same rules apply (called in a background thread; should always return a response).

classmethod get_local_action_type() → type[PlaylistLocalAction][source]

Return the family class for the local-actions we handle.

Domains with no local-actions can leave this as is and pass typing.Never as their local-action type arg.

classmethod get_route_type() → type[PlaylistRoute][source]

Return the family class for the routes we handle.

get_window_toolbar_visibility() → Literal['menu_full', 'menu_minimal'][source]

Which toolbar our windows show.

Everything by default. Settings-style pages reachable mid-game typically return 'menu_minimal' unless bauiv1.in_main_menu(), as the classic settings windows do.

run_local_action(action: AnyPlaylistLocalAction, context: DocUILocalAction) → None[source]

Do something locally on behalf of the doc-ui.

The type-safe equivalent of local_action(); the same cautions apply. The original action is passed as context for access to the originating widget and window.

class bauiv1lib.playlist.browserdocui.PlaylistLocalAction[source]

Bases: DocUILocalActionBase

Family class for the playlist browser local-actions.

classmethod get_action_types() → tuple[type[DocUILocalActionBase], ...][source]

Return all concrete local-actions in this family.

Must be overridden by each family class; see get_route_types().

class bauiv1lib.playlist.browserdocui.PlaylistRoute[source]

Bases: DocUIRoute

Family class for the playlist browser routes.

classmethod get_route_types() → tuple[type[DocUIRoute], ...][source]

Return all concrete routes in this family.

Must be overridden by each family class. A family generally defines a union alias of its routes (which also gives handlers assert_never exhaustiveness) and returns family_members() of it here.

classmethod get_window_layout() → WindowLayout[source]

The layout windows browsing to this route open with.

browse() uses this unless told otherwise, so a route whose page is best shown at some layout declares it once rather than at every link.

Defaults to WIDE, which is the same size at every ui-scale, so a one-off page (a confirmation, a dialog) never ends up as a big mostly-empty window. LARGE, which grows to fill more of the screen at medium/large ui-scale, is for pages built to use that room (store listings and the like), and they ask for it explicitly.

class bauiv1lib.playlist.browserdocui.PlaylistSelectController[source]

Bases: PlaylistBrowserController

The playlist browser for picking a private-party playlist.

Open it at Playlists routes with select set (the play page’s select mode does). Its own class keeps these windows distinct from the play flow’s for navigation, and it shows a minimal toolbar (as the legacy select flow did): we’re mid-errand for the gather window.

get_window_toolbar_visibility() → Literal['menu_full', 'menu_minimal'][source]

Which toolbar our windows show.

Everything by default. Settings-style pages reachable mid-game typically return 'menu_minimal' unless bauiv1.in_main_menu(), as the classic settings windows do.

class bauiv1lib.playlist.browserdocui.Playlists(kind: SessionKind, select: bool = False)[source]

Bases: PlaylistRoute

The playlists of one kind.

kind: SessionKind
select: bool = False

Picking a playlist for private-party hosting instead of playing.

class bauiv1lib.playlist.browserdocui.SessionKind(*values)[source]

Bases: Enum

Which kind of playlists a page shows.

FREE_FOR_ALL = 'ffa'
TEAMS = 'teams'
sessiontype() → type[Session][source]

The session type for this kind.

bauiv1lib.playlist.customizebrowser module

Provides UI for viewing/creating/editing playlists.

class bauiv1lib.playlist.customizebrowser.PlaylistCustomizeBrowserWindow(sessiontype: type[bs.Session], transition: str | None = 'in_right', origin_widget: bui.Widget | None = None, select_playlist: str | None = None)[source]

Bases: MainWindow

Window for viewing a playlist.

get_main_window_state() → MainWindowState[source]

Return a WindowState to recreate this specific window.

Used to gracefully return to a window from another window or ui system.

main_window_should_preserve_selection() → bool[source]

Whether this window should auto-save/restore selection.

If enabled, selection will be stored in the window’s shared state. See get_main_window_shared_state_id() for more info about main-window shared-state.

The default value of None results in a warning to explicitly override this (as the implicit default will change from False to True after api 9 support ends).

on_main_window_close() → None[source]

Called before transitioning out a main window.

A good opportunity to save window state/etc.

bauiv1lib.playlist.edit module

Provides a window for editing individual game playlists.

class bauiv1lib.playlist.edit.PlaylistEditWindow(editcontroller: PlaylistEditController, transition: str | None = 'in_right', origin_widget: bui.Widget | None = None)[source]

Bases: MainWindow

Window for editing an individual game playlist.

get_main_window_state() → MainWindowState[source]

Return a WindowState to recreate this specific window.

Used to gracefully return to a window from another window or ui system.

main_window_should_preserve_selection() → bool[source]

Whether this window should auto-save/restore selection.

If enabled, selection will be stored in the window’s shared state. See get_main_window_shared_state_id() for more info about main-window shared-state.

The default value of None results in a warning to explicitly override this (as the implicit default will change from False to True after api 9 support ends).

bauiv1lib.playlist.editcontroller module

Defines a controller for wrangling playlist edit UIs.

class bauiv1lib.playlist.editcontroller.PlaylistEditController(sessiontype: type[Session], from_window: MainWindow, *, existing_playlist_name: str | None = None, playlist: list[dict[str, Any]] | None = None, playlist_name: str | None = None)[source]

Bases: object

Coordinates various UIs involved in playlist editing.

add_game_pressed(from_window: MainWindow) → None[source]

(internal)

add_game_type_selected(gametype: type[GameActivity], from_window: MainWindow) → None[source]

(internal)

edit_game_pressed(from_window: MainWindow) → None[source]

Should be called by supplemental UIs when a game is to be edited.

get_config_name() → str[source]

(internal)

get_default_list_name() → LangStr[source]

(internal)

get_edit_ui_selection() → str | None[source]

(internal)

get_existing_playlist_name() → str | None[source]

(internal)

get_playlist() → list[dict[str, Any]][source]

Return the current state of the edited playlist.

get_selected_index() → int[source]

Return the index of the selected playlist.

get_session_type() → type[Session][source]

Return the bascenev1.Session type for this edit-session.

getname() → str[source]

(internal)

set_edit_ui_selection(selection: str) → None[source]

(internal)

set_playlist(playlist: list[dict[str, Any]]) → None[source]

Set the playlist contents.

set_selected_index(index: int) → None[source]

Sets the selected playlist index.

setname(name: str) → None[source]

(internal)

bauiv1lib.playlist.editgame module

Provides UI for editing a game config.

class bauiv1lib.playlist.editgame.PlaylistEditGameWindow(gametype: type[GameActivity], sessiontype: type[Session], config: dict[str, Any] | None, completion_call: Callable[[dict[str, Any] | None, MainWindow], Any], default_selection: str | None = None, transition: str | None = 'in_right', origin_widget: Widget | None = None, edit_info: dict[str, Any] | None = None)[source]

Bases: MainWindow

Window for editing a game config.

get_main_window_state() → MainWindowState[source]

Return a WindowState to recreate this specific window.

Used to gracefully return to a window from another window or ui system.

main_window_should_preserve_selection() → bool[source]

Whether this window should auto-save/restore selection.

If enabled, selection will be stored in the window’s shared state. See get_main_window_shared_state_id() for more info about main-window shared-state.

The default value of None results in a warning to explicitly override this (as the implicit default will change from False to True after api 9 support ends).

bauiv1lib.playlist.mapselect module

Provides UI for selecting maps in playlists.

class bauiv1lib.playlist.mapselect.PlaylistMapSelectWindow(gametype: type[bs.GameActivity], sessiontype: type[bs.Session], config: dict[str, Any], edit_info: dict[str, Any], completion_call: Callable[[dict[str, Any] | None, bui.MainWindow], Any], transition: str | None = 'in_right', origin_widget: bui.Widget | None = None, select_get_more_maps_button: bool = False)[source]

Bases: MainWindow

Window to select a map.

get_main_window_state() → MainWindowState[source]

Return a WindowState to recreate this specific window.

Used to gracefully return to a window from another window or ui system.

main_window_should_preserve_selection() → bool[source]

Whether this window should auto-save/restore selection.

If enabled, selection will be stored in the window’s shared state. See get_main_window_shared_state_id() for more info about main-window shared-state.

The default value of None results in a warning to explicitly override this (as the implicit default will change from False to True after api 9 support ends).

bauiv1lib.playlist.share module

UI functionality for importing shared playlists.

class bauiv1lib.playlist.share.SharePlaylistImportWindow(origin_widget: Widget | None = None, on_success_callback: Callable[[], Any] | None = None)[source]

Bases: SendInfoWindowLegacyModal

Window for importing a shared playlist.

class bauiv1lib.playlist.share.SharePlaylistResultsWindow(name: str, code: str, origin: tuple[float, float] = (0.0, 0.0))[source]

Bases: Window

Window for sharing playlists.

close() → None[source]

Close the window.