bauiv1lib package¶
Library of stuff using the bauiv1 api: windows, custom controls, etc.
Subpackages¶
Submodules¶
bauiv1lib.achievements module¶
Provides a popup window to view achievements.
- class bauiv1lib.achievements.AchievementsWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None, auxiliary_style: bool = True)[source]¶
Bases:
MainWindowPopup window to view achievements.
- 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.appinvite module¶
UI functionality related to inviting people to try the game.
bauiv1lib.characterpicker module¶
Provides a picker for characters.
- class bauiv1lib.characterpicker.CharacterPicker(parent: Widget, position: tuple[float, float] = (0.0, 0.0), delegate: CharacterPickerDelegate | None = 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:
PopupWindowPopup window for selecting characters.
bauiv1lib.chest module¶
Provides chest related ui.
- class bauiv1lib.chest.ChestWindow(index: int, transition: str | None = 'in_right', origin_widget: Widget | None = None, auxiliary_style: bool = True)[source]¶
Bases:
MainWindowAllows viewing and performing operations on a chest.
- 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.colorpicker module¶
Provides popup windows for choosing colors.
- class bauiv1lib.colorpicker.ColorPicker(parent: 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:
PopupWindowA popup UI to select from a set of colors.
Passes the color to the delegate’s color_picker_selected_color() method.
- class bauiv1lib.colorpicker.ColorPickerExact(parent: 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:
PopupWindowpops up a ui to select from a set of colors. passes the color to the delegate’s color_picker_selected_color() method
- bauiv1lib.colorpicker.color_overlay_func(r: float, g: float, b: float, a: float | None = None) tuple[float, ...][source]¶
I could NOT come up with a better function name.
- Parameters:
r – Red.
g – Green.
b – Blue.
a – Alpha. Defaults to None.
- Returns:
- A brighter color if the provided one is dark,
and a darker one if it’s darker.
- Return type:
- 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 – Red.
g – Green.
b – Blue.
a – Alpha. Defaults to 1.0.
- Returns:
The hexified rgba values.
- Return type:
- 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:
bauiv1lib.config module¶
Functionality for editing config values and applying them to the game.
- bauiv1lib.config.CONTROL_HEIGHT = 28.0¶
Height of a row’s editing widgets.
- bauiv1lib.config.CONTROL_X_OFFSET = 230.0¶
Where a control’s editing widgets begin, measured from the row’s position. Shared so a row keeps its layout when its control is swapped for a different kind.
- class bauiv1lib.config.ConfigCheckBox(parent: Widget, configkey: str, position: tuple[float, float], size: tuple[float, float], *, displayname: str | Lstr | LangStr | None = None, scale: float | None = None, maxwidth: float | None = None, autoselect: bool = True, value_change_call: Callable[[Any], Any] | None = None, check_box_id: str | None = None)[source]¶
Bases:
objectA checkbox wired up to control a config value.
It will automatically save and apply the config when its value changes.
- class bauiv1lib.config.ConfigNumberEdit(parent: 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 | Lstr | LangStr | None = None, changesound: bool = True, textscale: float = 1.0, as_percent: bool = False, fallback_value: float = 0.0, f: int = 1, idprefix: str | None = None)[source]¶
Bases:
_NumericConfigControlA set of controls for editing a numeric config value.
It will automatically save and apply the config when its value changes.
- class bauiv1lib.config.ConfigSlider(parent: 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, width: float = 200.0, displayname: str | Lstr | LangStr | None = None, textscale: float = 1.0, as_percent: bool = False, fallback_value: float = 0.0, f: int = 1, idprefix: str | None = None, drag_apply_interval: float = 0.25, drag_apply_delay: float = 0.0)[source]¶
Bases:
_NumericConfigControlA slider for editing a numeric config value.
Same config behavior as
ConfigNumberEdit– it reads the value at construction and saves and applies it on change – but driven by a draggable slider rather than a +/- pair. It begins where that pair does, so swapping one for the other leaves the rest of a settings row where it was.
- bauiv1lib.config.DRAG_APPLY_INTERVAL = 0.25¶
Default for how often a drag in progress applies its value to the running app. Paced for what accompanies an apply – a sound, a music level shifting – rather than for the cost of the apply itself; those read as busy well before they become expensive. Note this throttles only the apply: whatever a control refreshes cheaply per drag step (its value text, say) is not on this clock. A row wanting a different pace passes its own
drag_apply_interval– slower where an apply is audible, faster where it drives something visible on screen.
bauiv1lib.confirm module¶
Provides ConfirmWindow base class and commonly used derivatives.
- class bauiv1lib.confirm.ConfirmWindow(text: str | Lstr | LangStr | None = None, 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 | Lstr | LangStr | None = None, cancel_text: str | Lstr | LangStr | None = None, origin_widget: Widget | None = None, permanent_ok_fade: bool = False)[source]¶
Bases:
objectWindow for answering simple yes/no questions.
bauiv1lib.connect module¶
UI functionality related to master-server connectivity.
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:
WindowWindow 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 is waiting for connectivity.
bauiv1lib.controlpermission module¶
Asking whether an outside party may control this app.
- class bauiv1lib.controlpermission.ControlPermissionWindow(*, on_result: Callable[[bool, bool], None], allow_remember: bool)[source]¶
Bases:
objectPuts a request to control this app in front of the user.
Answers exactly once, whatever happens to the window: dismissing it counts as a refusal, because ‘they walked away’ and ‘they said no’ should not lead to different amounts of access.
bauiv1lib.credits module¶
Provides a window to display game credits.
- class bauiv1lib.credits.CreditsWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]¶
Bases:
MainWindowWindow for displaying game credits.
- 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.discord module¶
UI functionality for the Discord window.
bauiv1lib.docuitest module¶
Examples/tests for using DocUI to build UIs.
- class bauiv1lib.docuitest.TestDocUIV2Controller[source]¶
Bases:
DocUIControllerTests/demonstrations of native (v2 / l-string) docui.
Local pages are authored client-side; the
/cloudmsgtest/*and/webtest/*paths fetch equivalent v2 pages from bamaster.- fulfill_request(request: DocUIRequest) DocUIResponse[source]¶
Fulfill a v2 request (called in a background thread).
- local_action(action: DocUILocalAction) None[source]¶
Do something locally on behalf of the doc-ui.
Controller classes can override this to expose named actions that can be triggered by doc-ui button presses, responses, etc.
Of course controllers can also perform arbitrary local actions alongside their normal request fulfillment; this is simply a way to do so without needing to provide actual ui pages alongside.
Be very careful and focused with what you expose here, especially if your doc-ui pages are coming from untrusted sources. Generally things like launching or joining games are good candidates for local actions.
- bauiv1lib.docuitest.show_test_doc_ui_v2_window() None[source]¶
Bust out a doc-ui test window built locally on the client.
Test pages authored as language-agnostic v2 documents — text as
LangStrSpecvalues from thebadocuiv2testassetspackage (decoded in the client’s locale at render time), textures/meshes as typed refs, and multi-line labels via wrap-params instead of hand-baked newlines. The Cloud-Msg and Web buttons fetch equivalent v2 pages from bamaster, keeping the full cloud/web resolve -> decode -> render paths exercised.
bauiv1lib.docuitestframes module¶
The doc-ui frames test page.
Frames come in two flavors and this page shows them side by side: a plain one, which just places its children, and a sized one, which measures them, centers them, and shrinks them to fit its box.
The composition is deliberately far too big for the box it is given, so the sized version has to both scale and center for it to land – a combo that already fitted would prove nothing. The debug toggle draws every bound involved: the item’s box in cyan, the extent the children occupy in magenta, and each child’s own bounds in their usual colors.
See docs/initiatives/docui-frames.md.
- bauiv1lib.docuitestframes.test_page_frames(request: bacommon.docui.v2.Request) bacommon.docui.v2.Response[source]¶
Testing frames, with and without size-to-fit.
bauiv1lib.docuitestitems module¶
The doc-ui display-items test page.
A display-item stays what it always was – show this thing in this
style. What changes is what that turns into: the depiction now comes
as a Frame rather than being derived
client-side from the item type.
This page began as an A/B of the two, which is how their equivalence was established. The client no longer draws the legacy decoration at all, so what is left is a renderer regression check – every item type and style, drawable with no server and no account.
See docs/initiatives/docui-frames.md.
- bauiv1lib.docuitestitems.test_page_display_items(request: bacommon.docui.v2.Request) bacommon.docui.v2.Response[source]¶
Testing display-items (v2 mirror of ‘/displayitems’).
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, transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]¶
Bases:
MainWindowWindow for selecting files.
- 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.getremote module¶
Provides a popup telling the user about the BSRemote app.
bauiv1lib.gettokens module¶
UI functionality for purchasing/acquiring currency.
- class bauiv1lib.gettokens.GetTokensWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None, auxiliary_style: bool = True)[source]¶
Bases:
MainWindowWindow for purchasing/acquiring classic tickets.
- class State(*values)[source]¶
Bases:
EnumWhat are we doing?
- HAVE_GOLD_PASS = 'have_gold_pass'¶
- LOADING = 'loading'¶
- NOT_SIGNED_IN = 'not_signed_in'¶
- SHOWING_STORE = 'showing_store'¶
- 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).
- class bauiv1lib.gettokens.TextContents(*values)[source]¶
Bases:
EnumSome type of text to show.
- PRICE = 'price'¶
bauiv1lib.help module¶
Provides help related ui.
- class bauiv1lib.help.HelpWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]¶
Bases:
MainWindowA window providing help on how to play.
- 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.iconpicker module¶
Provides a picker for icons.
- class bauiv1lib.iconpicker.IconPicker(parent: Widget, position: tuple[float, float] = (0.0, 0.0), delegate: IconPickerDelegate | None = 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:
PopupWindowPicker for icons.
bauiv1lib.inbox module¶
Provides a popup window to view achievements.
- class bauiv1lib.inbox.InboxWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None, auxiliary_style: bool = True)[source]¶
Bases:
MainWindowPopup window to show account messages.
- 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.inventory module¶
Provides help related ui.
- class bauiv1lib.inventory.InventoryUIController(player_profiles_only: bool = False)[source]¶
Bases:
DocUIControllerDocUI setup for inventory.
- fulfill_request(request: DocUIRequest) DocUIResponse[source]¶
Handle request fulfillment.
Expected to be overridden by child classes.
Be aware that this will always be called in a background thread.
This method is expected to always return a response, even in the case of errors. Use
error_response()to translate error conditions to responses.The one exception to this rule (no pun intended) is the
efro.error.CleanErrorexception. This can be raised as a quick and dirty way to show custom error messages. The coderaise CleanError('Something broke.')will have the same effect asreturn self.error_response(custom_message='Something broke.').
- get_cache_key_extra() str | None[source]¶
Extra identity for response caching.
Cached responses are keyed by controller class, request, account and locale. A controller whose instance state changes what it returns for a given request must declare that state here; otherwise two instances differing in it share one cache entry and briefly show each other’s pages.
Return
Noneto opt out of caching entirely, which is the right answer when a response depends on state that cannot be summarized as a string.
- local_action(action: DocUILocalAction) None[source]¶
Do something locally on behalf of the doc-ui.
Controller classes can override this to expose named actions that can be triggered by doc-ui button presses, responses, etc.
Of course controllers can also perform arbitrary local actions alongside their normal request fulfillment; this is simply a way to do so without needing to provide actual ui pages alongside.
Be very careful and focused with what you expose here, especially if your doc-ui pages are coming from untrusted sources. Generally things like launching or joining games are good candidates for local actions.
Called when a window shared state is being restored.
bauiv1lib.kiosk module¶
UI functionality for running the game in kiosk mode.
- class bauiv1lib.kiosk.KioskWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]¶
Bases:
MainWindowKiosk mode window.
- 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.party module¶
Provides party related UI.
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:
WindowWindow 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:
objectRepresents a single dude waiting in a server line.
- on_account_press(account_id: str | None, origin_widget: Widget) None[source]¶
A dude was clicked so we should show his account info.
bauiv1lib.passwordprompt module¶
A minimal password-entry prompt dialog.
- class bauiv1lib.passwordprompt.PasswordPromptWindow(*, description: str | Lstr | LangStr | None = None, on_result: Callable[[str | None], None] | None = None)[source]¶
Bases:
objectSmall modal overlay window prompting for a password.
Calls
on_resultexactly once: the entered password on submit or None on cancel (via the cancel button, back press, or an externaldismiss()).
bauiv1lib.play module¶
Provides the top level play window.
- class bauiv1lib.play.PlayWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None, playlist_select_context: PlaylistSelectContext | None = None)[source]¶
Bases:
MainWindowWindow for selecting overall play type.
- 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.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, playlist_select_context: PlaylistSelectContext | None = None)[source]¶
Bases:
PopupWindowA popup window for configuring play options.
bauiv1lib.popup module¶
Popup window/menu related functionality.
- class bauiv1lib.popup.PopupMenu(parent: Widget, position: tuple[float, float], choices: Sequence[str], *, button_id: str | None = None, 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[Lstr | LangStr] | None = None, button_size: tuple[float, float] = (160.0, 50.0), autoselect: bool = True)[source]¶
Bases:
objectA complete popup-menu control.
This creates a button and wrangles its pop-up menu.
- get_window_widget() Widget | None[source]¶
Return the menu’s window widget (or None if nonexistent).
Called when the menu is closing.
Called when a choice is selected.
- 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[Lstr | LangStr] | None = None)[source]¶
Bases:
PopupWindowA menu built using popup-window functionality.
- 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: Literal['inherit', 'menu_minimal_no_back', 'menu_store_no_back'] = 'menu_minimal_no_back', edge_buffer_scale: float = 1.0, darken_behind: bool = True)[source]¶
Bases:
objectA transient window that pops up from some position.
bauiv1lib.qrcode module¶
Provides functionality for displaying QR codes.
bauiv1lib.radiogroup module¶
UI functionality for creating radio groups of buttons.
bauiv1lib.report module¶
UI related to reporting bad behavior/etc.
bauiv1lib.resourcetypeinfo module¶
Provides a window which shows info about resource types.
- class bauiv1lib.resourcetypeinfo.ResourceTypeInfoWindow(resource_type: Literal['tickets', 'tokens', 'trophies', 'xp'], origin_widget: Widget)[source]¶
Bases:
PopupWindowPopup window providing info about resource types.
bauiv1lib.sendinfo module¶
UI functionality for entering promo codes.
- class bauiv1lib.sendinfo.SendInfoWindow(transition: str | None = 'in_scale', origin_widget: Widget | None = None)[source]¶
Bases:
MainWindowWindow for sending info to the developer.
- 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.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:
objectData for ServerDialog.
- class bauiv1lib.serverdialog.ServerDialogWindow(data: ServerDialogData)[source]¶
Bases:
WindowA dialog window driven by the master-server.
bauiv1lib.store module¶
Shiny new doc-ui based store.
- class bauiv1lib.store.StoreUIController[source]¶
Bases:
DocUIControllerDocUI setup for store.
- fulfill_request(request: DocUIRequest) DocUIResponse[source]¶
Handle request fulfillment.
Expected to be overridden by child classes.
Be aware that this will always be called in a background thread.
This method is expected to always return a response, even in the case of errors. Use
error_response()to translate error conditions to responses.The one exception to this rule (no pun intended) is the
efro.error.CleanErrorexception. This can be raised as a quick and dirty way to show custom error messages. The coderaise CleanError('Something broke.')will have the same effect asreturn self.error_response(custom_message='Something broke.').
- local_action(action: DocUILocalAction) None[source]¶
Do something locally on behalf of the doc-ui.
Controller classes can override this to expose named actions that can be triggered by doc-ui button presses, responses, etc.
Of course controllers can also perform arbitrary local actions alongside their normal request fulfillment; this is simply a way to do so without needing to provide actual ui pages alongside.
Be very careful and focused with what you expose here, especially if your doc-ui pages are coming from untrusted sources. Generally things like launching or joining games are good candidates for local actions.
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:
objectInfo for an individual tab in a TabRow
- class bauiv1lib.tabs.TabRow(parent: bui.Widget, tabdefs: Sequence[tuple[T, bui.Lstr | bui.LangStr]], pos: tuple[float, float], size: tuple[float, float], *, on_select_call: Callable[[T], None] | None = None, idprefix: str | None = None)[source]¶
Bases:
GenericEncapsulates a row of tab-styled buttons.
Tabs are indexed by id which is an arbitrary user-provided type.
bauiv1lib.teamnamescolors module¶
Provides a window to customize team names and colors.
- class bauiv1lib.teamnamescolors.TeamNamesColorsWindow(scale_origin: tuple[float, float])[source]¶
Bases:
PopupWindowA popup window for customizing team names and colors.
- color_picker_closing(picker: ColorPicker) None[source]¶
Called when the color picker is closing.
bauiv1lib.template module¶
Useful starting points for new classes and whatnot.
- class bauiv1lib.template.TemplateMainWindow(dummy_data: int, *, transition: str | None = 'in_right', origin_widget: Widget | None = None, auxiliary_style: bool = True)[source]¶
Bases:
MainWindowAn example of a well-behaved main-window.
Provide a custom id for window shared state.
Unlike
MainWindowState, which is used to save and restore a single main-window instance, shared-state is intended to hold values that can apply to multiple instances of a window.By default, shared state uses the window class as an index (so is shared by all windows of the same class), but this method can be overridden to provide more distinct states. For example, a store-page main-window class might want to keep distinct states for different sub-pages it can display instead of having a single state for the whole class.
Note that shared state only persists for the current run of the app.
- 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.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:
PopupWindowPopup window for entering tournaments.
bauiv1lib.tournamentscores module¶
Provides a popup for viewing tournament scores.
bauiv1lib.trophies module¶
Provides a popup window for viewing trophies.
bauiv1lib.url module¶
UI functionality related to URLs.
bauiv1lib.utils module¶
Useful bits to use with UIs.
- bauiv1lib.utils.get_screen_margins(root_scale: float) tuple[float, float, float, float][source]¶
Return visible-screen margins outside the virtual rect.
Returns
(left, right, bottom, top)distances between the virtual rect edges and the virtual outer rect (true visible area) edges, converted into a window’s local coordinate space via its root container’sroot_scale. All values are zero unless the virtual bounds are inset (camera cutouts and such).Windows that fill the screen at small ui-scale should extend backing elements such as scroll areas outward by these amounts (insetting their content by the same amounts so it stays put) so the backing reaches the true screen edges instead of stopping at the virtual rect.
- bauiv1lib.utils.scroll_fade_bottom(container: Widget, scrollleft: float, scrollbottom: float, scrollwidth: float, scrollheight: float, *, center: bool = False, yscale: float = 1.0, yoffs_extra: float = 0.0) None[source]¶
Make content appear to fade towards the bottom of a scroll area.
This works by drawing background-texture-ish soft shapes obscuring the edge of the scroll area. The most opaque part of the shapes lands on the bottom edge of the provided scroll rect; use
yoffs_extrato nudge them up or down from there (e.g. to center them on a note below the scroll area).
- bauiv1lib.utils.scroll_fade_top(container: Widget, scrollleft: float, scrollbottom: float, scrollwidth: float, scrollheight: float, *, yscale: float = 1.0, yoffs_extra: float = 0.0) None[source]¶
Make content appear to fade towards the top of a scroll area.
This works by drawing background-texture-ish soft shapes obscuring the edge of the scroll area. The most opaque part of the shapes lands on the top edge of the provided scroll rect; use
yoffs_extrato nudge them up or down from there (e.g. to center them on a title above the scroll area).
bauiv1lib.v2upgrade module¶
UI for upgrading V1 accounts to V2.
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:
MainWindowWindow for watching replays.
- class TabID(*values)[source]¶
Bases:
EnumOur available tab types.
- MY_REPLAYS = 'my_replays'¶
- TEST_TAB = 'test_tab'¶
- 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).