Ballistica Logo

bauiv1lib package

Subpackages

Submodules

bauiv1lib.achievements module

Provides a popup window to view achievements.

class bauiv1lib.achievements.AchievementsWindow(position: tuple[float, float], scale: float | None = None)[source]

Bases: PopupWindow

Popup window to view achievements.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.appinvite module

UI functionality related to inviting people to try the game.

class bauiv1lib.appinvite.ShowFriendCodeWindow(data: dict[str, Any])[source]

Bases: Window

Window showing a code for sharing with friends.

close() None[source]

Close the window.

bauiv1lib.appinvite.handle_app_invites_press() None[source]

(internal)

bauiv1lib.characterpicker module

Provides a picker for characters.

class bauiv1lib.characterpicker.CharacterPicker(parent: bui.Widget, position: tuple[float, float] = (0.0, 0.0), delegate: Any = None, scale: float | None = None, offset: tuple[float, float] = (0.0, 0.0), tint_color: Sequence[float] = (1.0, 1.0, 1.0), tint2_color: Sequence[float] = (1.0, 1.0, 1.0), selected_character: str | None = None)[source]

Bases: PopupWindow

Popup window for selecting characters.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.colorpicker module

Provides popup windows for choosing colors.

class bauiv1lib.colorpicker.ColorPicker(parent: bui.Widget, position: tuple[float, float], initial_color: Sequence[float] = (1.0, 1.0, 1.0), delegate: Any = None, scale: float | None = None, offset: tuple[float, float] = (0.0, 0.0), tag: Any = '')[source]

Bases: PopupWindow

A popup UI to select from a set of colors.

Passes the color to the delegate’s color_picker_selected_color() method.

get_tag() Any[source]

Return this popup’s tag.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

class bauiv1lib.colorpicker.ColorPickerExact(parent: bui.Widget, position: tuple[float, float], initial_color: Sequence[float] = (1.0, 1.0, 1.0), delegate: Any = None, scale: float | None = None, offset: tuple[float, float] = (0.0, 0.0), tag: Any = '')[source]

Bases: PopupWindow

pops up a ui to select from a set of colors. passes the color to the delegate’s color_picker_selected_color() method

get_tag() Any[source]

Return this popup’s tag value.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.colorpicker.color_overlay_func(r: float, g: float, b: float, a: float | None = None) tuple[source]

I could NOT come up with a better function name.

Parameters:
  • r (float) – Red.

  • g (float) – Green.

  • b (float) – Blue.

  • a (float | None, optional) – Alpha. Defaults to None.

Returns:

A brighter color if the provided one is dark,

and a darker one if it’s darker.

Return type:

tuple

bauiv1lib.colorpicker.color_to_hex(r: float, g: float, b: float, a: float | None = 1.0) str[source]

Converts an rgb1 tuple to a HEX color code.

Parameters:
  • r (float) – Red.

  • g (float) – Green.

  • b (float) – Blue.

  • a (float, optional) – Alpha. Defaults to 1.0.

Returns:

The hexified rgba values.

Return type:

str

bauiv1lib.colorpicker.hex_to_color(hex_color: str) tuple[source]

Transforms an RGB / RGBA hex code into an rgb1/rgba1 tuple.

Parameters:

hex_color (str) – The HEX color.

Raises:

ValueError – If the provided HEX color isn’t 6 or 8 characters long.

Returns:

The color tuple divided by 255.

Return type:

tuple

bauiv1lib.config module

Functionality for editing config values and applying them to the game.

class bauiv1lib.config.ConfigCheckBox(parent: bui.Widget, configkey: str, position: tuple[float, float], size: tuple[float, float], displayname: str | bui.Lstr | None = None, scale: float | None = None, maxwidth: float | None = None, autoselect: bool = True, value_change_call: Callable[[Any], Any] | None = None)[source]

Bases: object

A checkbox wired up to control a config value.

It will automatically save and apply the config when its value changes.

widget: Widget

The underlying bui.Widget instance.

class bauiv1lib.config.ConfigNumberEdit(parent: bui.Widget, configkey: str, position: tuple[float, float], minval: float = 0.0, maxval: float = 100.0, increment: float = 1.0, callback: Callable[[float], Any] | None = None, xoffset: float = 0.0, displayname: str | bui.Lstr | None = None, changesound: bool = True, textscale: float = 1.0, as_percent: bool = False, fallback_value: float = 0.0, f: int = 1)[source]

Bases: object

A set of controls for editing a numeric config value.

It will automatically save and apply the config when its value changes.

minusbutton: Widget

The button widget used to reduce the value.

nametext: Widget

The text widget displaying the name.

plusbutton: Widget

The button widget used to increase the value.

valuetext: Widget

The text widget displaying the current value.

bauiv1lib.confirm module

Provides ConfirmWindow base class and commonly used derivatives.

class bauiv1lib.confirm.ConfirmWindow(text: str | bui.Lstr = 'Are you sure?', action: Callable[[], Any] | None = None, width: float = 360.0, height: float = 100.0, cancel_button: bool = True, cancel_is_selected: bool = False, color: tuple[float, float, float] = (1, 1, 1), text_scale: float = 1.0, ok_text: str | bui.Lstr | None = None, cancel_text: str | bui.Lstr | None = None, origin_widget: bui.Widget | None = None)[source]

Bases: object

Window for answering simple yes/no questions.

class bauiv1lib.confirm.QuitWindow(quit_type: QuitType | None = None, swish: bool = False, origin_widget: Widget | None = None)[source]

Bases: object

Popup window to confirm quitting.

bauiv1lib.connectivity module

UI functionality related to master-server connectivity.

class bauiv1lib.connectivity.WaitForConnectivityWindow(on_connected: Callable[[], Any], on_cancel: Callable[[], Any] | None)[source]

Bases: Window

Window informing the user that the game is establishing connectivity.

bauiv1lib.connectivity.wait_for_connectivity(on_connected: Callable[[], Any], on_cancel: Callable[[], Any] | None = None) None[source]

Wait for the engine to establish a master-server connection.

If need be, shows a window to keep the user informed of connectivity state and allows the user to cancel the operation. Note that canceling does not prevent the engine from continuing its attempt to establish connectivity; it simply cancels the operation that depends on it.

bauiv1lib.continues module

Provides a popup window to continue a game.

class bauiv1lib.continues.ContinuesWindow(activity: bs.Activity, cost: int, continue_call: Callable[[], Any], cancel_call: Callable[[], Any])[source]

Bases: Window

A window to continue a game.

bauiv1lib.creditslist module

Provides a window to display game credits.

class bauiv1lib.creditslist.CreditsListWindow(origin_widget: Widget | None = None)[source]

Bases: Window

Window for displaying game credits.

bauiv1lib.debug module

UIs for debugging purposes.

class bauiv1lib.debug.DebugWindow(transition: str | None = 'in_right')[source]

Bases: Window

Window for debugging internal values.

bauiv1lib.discord module

UI functionality for the Discord window.

class bauiv1lib.discord.DiscordWindow(transition: str = 'in_right', origin_widget: Widget | None = None)[source]

Bases: Window

Window for joining the Discord.

bauiv1lib.feedback module

UI functionality related to users rating the game.

bauiv1lib.feedback.ask_for_rating() Widget | None[source]

(internal)

bauiv1lib.fileselector module

UI functionality for selecting files.

class bauiv1lib.fileselector.FileSelectorWindow(path: str, callback: Callable[[str | None], Any] | None = None, show_base_path: bool = True, valid_file_extensions: Sequence[str] | None = None, allow_folders: bool = False)[source]

Bases: Window

Window for selecting files.

bauiv1lib.getcurrency module

UI functionality for purchasing/acquiring currency.

class bauiv1lib.getcurrency.GetCurrencyWindow(transition: str = 'in_right', from_modal_store: bool = False, modal: bool = False, origin_widget: Widget | None = None, store_back_location: str | None = None)[source]

Bases: Window

Window for purchasing/acquiring currency.

bauiv1lib.getcurrency.show_get_tickets_prompt() None[source]

Show a ‘not enough tickets’ prompt with an option to purchase more.

Note that the purchase option may not always be available depending on the build of the game.

bauiv1lib.getremote module

Provides a popup telling the user about the BSRemote app.

class bauiv1lib.getremote.GetBSRemoteWindow[source]

Bases: PopupWindow

Popup telling the user about BSRemote app.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.helpui module

Provides help related ui.

class bauiv1lib.helpui.HelpWindow(main_menu: bool = False, origin_widget: Widget | None = None)[source]

Bases: Window

A window providing help on how to play.

bauiv1lib.iconpicker module

Provides a picker for icons.

class bauiv1lib.iconpicker.IconPicker(parent: bui.Widget, position: tuple[float, float] = (0.0, 0.0), delegate: Any = None, scale: float | None = None, offset: tuple[float, float] = (0.0, 0.0), tint_color: Sequence[float] = (1.0, 1.0, 1.0), tint2_color: Sequence[float] = (1.0, 1.0, 1.0), selected_icon: str | None = None)[source]

Bases: PopupWindow

Picker for icons.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.kiosk module

UI functionality for running the game in kiosk mode.

class bauiv1lib.kiosk.KioskWindow(transition: str = 'in_right')[source]

Bases: Window

Kiosk mode window.

bauiv1lib.mainmenu module

Implements the main menu window.

class bauiv1lib.mainmenu.MainMenuWindow(transition: str | None = 'in_right')[source]

Bases: Window

The main menu window, both in-game and in the main menu session.

get_play_button() Widget | None[source]

Return the play button.

bauiv1lib.party module

Provides party related UI.

class bauiv1lib.party.PartyWindow(origin: Sequence[float] = (0, 0))[source]

Bases: Window

Party list/chat window.

close() None[source]

Close the window.

close_with_sound() None[source]

Close the window and make a lovely sound.

on_chat_message(msg: str) None[source]

Called when a new chat message comes through.

popup_menu_closing(popup_window: PopupWindow) None[source]

Called when the popup is closing.

popup_menu_selected_choice(popup_window: PopupMenuWindow, choice: str) None[source]

Called when a choice is selected in the popup.

bauiv1lib.partyqueue module

UI related to waiting in line for a party.

class bauiv1lib.partyqueue.PartyQueueWindow(queue_id: str, address: str, port: int)[source]

Bases: Window

Window showing players waiting to join a server.

class Dude(parent: PartyQueueWindow, distance: float, initial_offset: float, is_player: bool, account_id: str, name: str)[source]

Bases: object

Represents a single dude waiting in a server line.

boost(amount: float, smoothing: float) None[source]

Boost this dude.

set_target_distance(dist: float) None[source]

Set distance for a dude.

step(smoothing: float) None[source]

Step this dude.

close() None[source]

Close the ui.

get_line_bottom() float[source]

(internal)

get_line_left() float[source]

(internal)

get_line_width() float[source]

(internal)

on_account_press(account_id: str | None, origin_widget: Widget) None[source]

A dude was clicked so we should show his account info.

on_boost_press() None[source]

Boost was pressed.

on_update_response(response: dict[str, Any] | None) None[source]

We’ve received a response from an update to the server.

update() None[source]

Update!

bauiv1lib.play module

Provides the top level play window.

class bauiv1lib.play.PlayWindow(transition: str = 'in_right', origin_widget: Widget | None = None)[source]

Bases: Window

Window for selecting overall play type.

bauiv1lib.playoptions module

Provides a window for configuring play options.

class bauiv1lib.playoptions.PlayOptionsWindow(sessiontype: type[bs.Session], playlist: str, scale_origin: tuple[float, float], delegate: Any = None)[source]

Bases: PopupWindow

A popup window for configuring play options.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.popup module

Popup window/menu related functionality.

class bauiv1lib.popup.PopupMenu(parent: bui.Widget, position: tuple[float, float], choices: Sequence[str], current_choice: str | None = None, on_value_change_call: Callable[[str], Any] | None = None, opening_call: Callable[[], Any] | None = None, closing_call: Callable[[], Any] | None = None, width: float = 230.0, maxwidth: float | None = None, scale: float | None = None, choices_disabled: Sequence[str] | None = None, choices_display: Sequence[bui.Lstr] | None = None, button_size: tuple[float, float] = (160.0, 50.0), autoselect: bool = True)[source]

Bases: object

A complete popup-menu control.

This creates a button and wrangles its pop-up menu.

get_button() Widget[source]

Return the menu’s button widget.

get_window_widget() Widget | None[source]

Return the menu’s window widget (or None if nonexistent).

popup_menu_closing(popup_window: PopupWindow) None[source]

Called when the menu is closing.

popup_menu_selected_choice(popup_window: PopupWindow, choice: str) None[source]

Called when a choice is selected.

set_choice(choice: str) None[source]

Set the selected choice.

class bauiv1lib.popup.PopupMenuWindow(position: tuple[float, float], choices: Sequence[str], current_choice: str, delegate: Any = None, width: float = 230.0, maxwidth: float | None = None, scale: float = 1.0, choices_disabled: Sequence[str] | None = None, choices_display: Sequence[bui.Lstr] | None = None)[source]

Bases: PopupWindow

A menu built using popup-window functionality.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

class bauiv1lib.popup.PopupWindow(position: tuple[float, float], size: tuple[float, float], scale: float = 1.0, offset: tuple[float, float] = (0, 0), bg_color: tuple[float, float, float] = (0.35, 0.55, 0.15), focus_position: tuple[float, float] = (0, 0), focus_size: tuple[float, float] | None = None, toolbar_visibility: str = 'menu_minimal_no_back')[source]

Bases: object

A transient window that positions and scales itself for visibility.

Category: UI Classes

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.purchase module

UI related to purchasing items.

class bauiv1lib.purchase.PurchaseWindow(items: list[str], transition: str = 'in_right', header_text: Lstr | None = None)[source]

Bases: Window

Window for purchasing one or more items.

bauiv1lib.qrcode module

Provides functionality for displaying QR codes.

class bauiv1lib.qrcode.QRCodeWindow(origin_widget: Widget, qr_tex: Texture)[source]

Bases: PopupWindow

Popup window that shows a QR code.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.radiogroup module

UI functionality for creating radio groups of buttons.

bauiv1lib.radiogroup.make_radio_group(check_boxes: Sequence[bui.Widget], value_names: Sequence[str], value: str, value_change_call: Callable[[str], Any]) None[source]

Link the provided check_boxes together into a radio group.

bauiv1lib.report module

UI related to reporting bad behavior/etc.

class bauiv1lib.report.ReportPlayerWindow(account_id: str, origin_widget: Widget)[source]

Bases: Window

Player for reporting naughty players.

close() None[source]

Close the window.

bauiv1lib.resourcetypeinfo module

Provides a window which shows info about resource types.

class bauiv1lib.resourcetypeinfo.ResourceTypeInfoWindow(origin_widget: Widget)[source]

Bases: PopupWindow

Popup window providing info about resource types.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.sendinfo module

UI functionality for entering promo codes.

class bauiv1lib.sendinfo.SendInfoWindow(modal: bool = False, legacy_code_mode: bool = False, origin_widget: Widget | None = None)[source]

Bases: Window

Window for sending info to the developer.

bauiv1lib.serverdialog module

Dialog window controlled by the master server.

class bauiv1lib.serverdialog.ServerDialogData(dialog_id: str, text: str, subs: list[tuple[str, str]] = <factory>, show_cancel: bool = True, copy_text: str | None = None)[source]

Bases: object

Data for ServerDialog.

copy_text: str | None = None
dialog_id: str
show_cancel: bool = True
subs: list[tuple[str, str]]
text: str
class bauiv1lib.serverdialog.ServerDialogWindow(data: ServerDialogData)[source]

Bases: Window

A dialog window driven by the master-server.

bauiv1lib.specialoffer module

UI for presenting sales/etc.

class bauiv1lib.specialoffer.SpecialOfferWindow(offer: dict[str, Any], transition: str = 'in_right')[source]

Bases: Window

Window for presenting sales/etc.

bauiv1lib.specialoffer.show_offer() bool[source]

(internal)

bauiv1lib.tabs module

UI functionality for creating tab style buttons.

class bauiv1lib.tabs.Tab(button: Widget, position: tuple[float, float], size: tuple[float, float])[source]

Bases: object

Info for an individual tab in a TabRow

button: Widget
position: tuple[float, float]
size: tuple[float, float]
class bauiv1lib.tabs.TabRow(parent: bui.Widget, tabdefs: list[tuple[T, bui.Lstr]], pos: tuple[float, float], size: tuple[float, float], on_select_call: Callable[[T], None] | None = None)[source]

Bases: Generic[T]

Encapsulates a row of tab-styled buttons.

Tabs are indexed by id which is an arbitrary user-provided type.

update_appearance(selected_tab_id: T) None[source]

Update appearances to make the provided tab appear selected.

bauiv1lib.teamnamescolors module

Provides a window to customize team names and colors.

class bauiv1lib.teamnamescolors.TeamNamesColorsWindow(scale_origin: tuple[float, float])[source]

Bases: PopupWindow

A popup window for customizing team names and colors.

color_picker_closing(picker: ColorPicker) None[source]

Called when the color picker is closing.

color_picker_selected_color(picker: ColorPicker, color: Sequence[float]) None[source]

Called when a color is selected in the color picker.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.tournamententry module

Defines a popup window for entering tournaments.

class bauiv1lib.tournamententry.TournamentEntryWindow(tournament_id: str, tournament_activity: bs.Activity | None = None, position: tuple[float, float] = (0.0, 0.0), delegate: Any = None, scale: float | None = None, offset: tuple[float, float] = (0.0, 0.0), on_close_call: Callable[[], Any] | None = None)[source]

Bases: PopupWindow

Popup window for entering tournaments.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.tournamentscores module

Provides a popup for viewing tournament scores.

class bauiv1lib.tournamentscores.TournamentScoresWindow(tournament_id: str, tournament_activity: bs.GameActivity | None = None, position: tuple[float, float] = (0.0, 0.0), scale: float | None = None, offset: tuple[float, float] = (0.0, 0.0), tint_color: Sequence[float] = (1.0, 1.0, 1.0), tint2_color: Sequence[float] = (1.0, 1.0, 1.0), selected_character: str | None = None, on_close_call: Callable[[], Any] | None = None)[source]

Bases: PopupWindow

Window for viewing tournament scores.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.trophies module

Provides a popup window for viewing trophies.

class bauiv1lib.trophies.TrophiesWindow(position: tuple[float, float], data: dict[str, Any], scale: float | None = None)[source]

Bases: PopupWindow

Popup window for viewing trophies.

on_popup_cancel() None[source]

Called when the popup is canceled.

Cancels can occur due to clicking outside the window, hitting escape, etc.

bauiv1lib.url module

UI functionality related to URLs.

class bauiv1lib.url.ShowURLWindow(address: str)[source]

Bases: Window

A window presenting a URL to the user visually.

bauiv1lib.v2upgrade module

UI for upgrading V1 accounts to V2.

class bauiv1lib.v2upgrade.V2UpgradeWindow(login_name: str, code: str)[source]

Bases: Window

A window presenting a URL to the user visually.

bauiv1lib.watch module

Provides UI functionality for watching replays.

class bauiv1lib.watch.WatchWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]

Bases: Window

Window for watching replays.

class TabID(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Our available tab types.

MY_REPLAYS = 'my_replays'
TEST_TAB = 'test_tab'

Module contents

Library of stuff using the bauiv1 api: windows, custom controls, etc.