bauiv1lib.settings package

Submodules

bauiv1lib.settings.advanced module

Advanced settings, as a doc-ui page.

A client-local doc-ui domain like the audio settings: the page is authored here, its controls keep their values in typed page state mirroring the config, and each change is a typed local action that writes the config. Buttons leading elsewhere are local actions too, opening the existing (non-doc-ui) windows.

class bauiv1lib.settings.advanced.AdvancedLocalAction[source]

Bases: DocUILocalActionBase

Family class for the advanced settings 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.settings.advanced.AdvancedRoute[source]

Bases: DocUIRoute

Family class for the advanced settings 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.settings.advanced.AdvancedSettingsController[source]

Bases: TypedDocUIController[Root, SetLanguage | ApplySetting | Open | SendTranslationFeedback]

Doc-ui controller for the advanced settings page.

fulfill_route(route: AnyAdvancedRoute) → 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[AdvancedLocalAction][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[AdvancedRoute][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: AnyAdvancedLocalAction, 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.settings.advanced.AdvancedState(language: str = 'Auto', kick_idle_players: bool = False, show_ping: bool = False, show_demos_when_idle: bool = False, disable_camera_shake: bool = False, disable_camera_gyro: bool = False, insecure_connections: InsecureConnections = InsecureConnections.AUTO, always_use_internal_keyboard: bool = False, allow_extreme_aspect_ratios: bool = False, legacy_character_physics: bool = False)[source]

Bases: DocUIState

The page’s values, mirroring the config.

allow_extreme_aspect_ratios: bool = False
always_use_internal_keyboard: bool = False
disable_camera_gyro: bool = False
disable_camera_shake: bool = False
insecure_connections: InsecureConnections = 'auto'
kick_idle_players: bool = False
language: str = 'Auto'

A locale long-value, or _LANGUAGE_AUTO.

legacy_character_physics: bool = False
show_demos_when_idle: bool = False
show_ping: bool = False
bauiv1lib.settings.advanced.AnyAdvancedRoute

alias of Root

class bauiv1lib.settings.advanced.ApplySetting[source]

Bases: AdvancedLocalAction

Write the setting that changed (the trigger) to the config.

class bauiv1lib.settings.advanced.InsecureConnections(*values)[source]

Bases: Enum

The tri-state Insecure Connections setting (its config values).

ALWAYS = 'always'
AUTO = 'auto'
NEVER = 'never'
class bauiv1lib.settings.advanced.Open(target: Target)[source]

Bases: AdvancedLocalAction

Go somewhere.

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.

target: Target
class bauiv1lib.settings.advanced.Root[source]

Bases: AdvancedRoute

The advanced settings page.

class bauiv1lib.settings.advanced.SendTranslationFeedback[source]

Bases: AdvancedLocalAction

Report a translation that could be improved.

class bauiv1lib.settings.advanced.SetLanguage[source]

Bases: AdvancedLocalAction

Switch to the language the page’s state holds.

class bauiv1lib.settings.advanced.Target(*values)[source]

Bases: Enum

Windows the page’s buttons lead to.

BENCHMARKS = 'benchmarks'
DEV_TOOLS = 'dev_tools'
MODDING_GUIDE = 'modding_guide'
MODS_FOLDER = 'mods_folder'
NET_TEST = 'net_test'
PLUGINS = 'plugins'
SEND_INFO = 'send_info'
VR_TEST = 'vr_test'

bauiv1lib.settings.allsettingsdocui module

The top level settings window, as a doc-ui page.

A client-local doc-ui domain: one centered row of big buttons leading to the controls, graphics, audio and advanced settings pages; opened by the toolbar’s settings button. (Replaces the legacy AllSettingsWindow.)

class bauiv1lib.settings.allsettingsdocui.AllSettingsController[source]

Bases: TypedDocUIController[Root, Open]

Doc-ui controller for the top level settings page.

fulfill_route(route: AnySettingsRoute) → 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[SettingsLocalAction][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[SettingsRoute][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: AnySettingsLocalAction, 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.

bauiv1lib.settings.allsettingsdocui.AnySettingsLocalAction

alias of Open

bauiv1lib.settings.allsettingsdocui.AnySettingsRoute

alias of Root

class bauiv1lib.settings.allsettingsdocui.Open(target: Target)[source]

Bases: SettingsLocalAction

Go to a settings category.

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.

target: Target
class bauiv1lib.settings.allsettingsdocui.Root[source]

Bases: SettingsRoute

The top level settings page.

class bauiv1lib.settings.allsettingsdocui.SettingsLocalAction[source]

Bases: DocUILocalActionBase

Family class for the settings 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.settings.allsettingsdocui.SettingsRoute[source]

Bases: DocUIRoute

Family class for the settings 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.settings.allsettingsdocui.Target(*values)[source]

Bases: Enum

Where the page’s buttons lead.

ADVANCED = 'advanced'
AUDIO = 'audio'
CONTROLLERS = 'controllers'
GRAPHICS = 'graphics'

bauiv1lib.settings.audio module

Audio settings, as a doc-ui page.

A client-local doc-ui domain: the page is authored here, its volume sliders keep their values in typed page state, and everything that must happen live – the volume being set as a slider is dragged, the test blip – is a typed local action reading that state. No requests leave the device.

bauiv1lib.settings.audio.AnyAudioRoute

alias of Root

class bauiv1lib.settings.audio.ApplyVolume[source]

Bases: AudioLocalAction

Apply a slider’s volume live (its on_drag): the running app hears it, plus whatever accompanies an apply – the sound slider’s blip, the music player’s level.

class bauiv1lib.settings.audio.AudioLocalAction[source]

Bases: DocUILocalActionBase

Family class for the audio settings 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.settings.audio.AudioRoute[source]

Bases: DocUIRoute

Family class for the audio settings 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.settings.audio.AudioSettingsController[source]

Bases: TypedDocUIController[Root, ApplyVolume | CommitVolume | OpenSoundtracks]

Doc-ui controller for the audio settings page.

fulfill_route(route: AnyAudioRoute) → 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[AudioLocalAction][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[AudioRoute][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: AnyAudioLocalAction, 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.settings.audio.AudioState(sound_volume: float = 1.0, music_volume: float = 1.0)[source]

Bases: DocUIState

The page’s volumes, mirroring the config values.

music_volume: float = 1.0
sound_volume: float = 1.0
class bauiv1lib.settings.audio.CommitVolume[source]

Bases: AudioLocalAction

Save a settled volume (its on_change).

class bauiv1lib.settings.audio.OpenSoundtracks[source]

Bases: AudioLocalAction

Open the soundtrack 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.

class bauiv1lib.settings.audio.Root[source]

Bases: AudioRoute

The audio settings page.

bauiv1lib.settings.benchmarks module

Benchmarks and stress tests, as a doc-ui page.

A client-local doc-ui domain like the other settings pages: the page is authored here, the stress-test options live in typed page state, and each button is a typed local action.

bauiv1lib.settings.benchmarks.AnyBenchmarksRoute

alias of Root

class bauiv1lib.settings.benchmarks.BenchmarksController[source]

Bases: TypedDocUIController[Root, RunCpuBenchmark | RunMediaReloadBenchmark | RunStressTest]

Doc-ui controller for the benchmarks page.

fulfill_route(route: AnyBenchmarksRoute) → 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[BenchmarksLocalAction][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[BenchmarksRoute][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: AnyBenchmarksLocalAction, 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.settings.benchmarks.BenchmarksLocalAction[source]

Bases: DocUILocalActionBase

Family class for the benchmarks 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.settings.benchmarks.BenchmarksRoute[source]

Bases: DocUIRoute

Family class for the benchmarks 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.settings.benchmarks.BenchmarksState(playlist_type: StressPlaylistType = StressPlaylistType.RANDOM, playlist_name: str = '__default__', player_count: float = 8.0, round_duration: float = 30.0)[source]

Bases: DocUIState

The stress-test options.

player_count: float = 8.0
playlist_name: str = '__default__'
playlist_type: StressPlaylistType = 'Random'
round_duration: float = 30.0

Seconds.

class bauiv1lib.settings.benchmarks.Root[source]

Bases: BenchmarksRoute

The benchmarks page.

class bauiv1lib.settings.benchmarks.RunCpuBenchmark[source]

Bases: BenchmarksLocalAction

Run the cpu benchmark.

class bauiv1lib.settings.benchmarks.RunMediaReloadBenchmark[source]

Bases: BenchmarksLocalAction

Run the media-reload benchmark.

class bauiv1lib.settings.benchmarks.RunStressTest[source]

Bases: BenchmarksLocalAction

Run a stress test with the options in page state.

class bauiv1lib.settings.benchmarks.StressPlaylistType(*values)[source]

Bases: Enum

Kinds of playlist a stress test can run (run_stress_test’s values).

FREE_FOR_ALL = 'Free-For-All'
RANDOM = 'Random'
TEAMS = 'Teams'

bauiv1lib.settings.controls module

The top level controls settings, as a doc-ui page.

A client-local doc-ui domain like the other settings pages: a stack of buttons leading to the per-kind controller settings (which are still legacy windows), plus a Windows-only XInput toggle in typed page state.

bauiv1lib.settings.controls.AnyControlsRoute

alias of Root

class bauiv1lib.settings.controls.ApplyXInput[source]

Bases: ControlsLocalAction

Write the disable-xinput setting to the config.

class bauiv1lib.settings.controls.ControlsLocalAction[source]

Bases: DocUILocalActionBase

Family class for the controls settings 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.settings.controls.ControlsRoute[source]

Bases: DocUIRoute

Family class for the controls settings 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.settings.controls.ControlsSettingsController[source]

Bases: TypedDocUIController[Root, Open | ApplyXInput]

Doc-ui controller for the controls settings page.

fulfill_route(route: AnyControlsRoute) → 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[ControlsLocalAction][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[ControlsRoute][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: AnyControlsLocalAction, 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.settings.controls.ControlsState(disable_xinput: bool = False)[source]

Bases: DocUIState

The page’s values, mirroring the config.

disable_xinput: bool = False
class bauiv1lib.settings.controls.Open(target: Target)[source]

Bases: ControlsLocalAction

Go somewhere.

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.

target: Target
class bauiv1lib.settings.controls.Root[source]

Bases: ControlsRoute

The controls settings page.

class bauiv1lib.settings.controls.Target(*values)[source]

Bases: Enum

Windows the page’s buttons lead to.

GAMEPADS = 'gamepads'
KEYBOARD = 'keyboard'
KEYBOARD_P2 = 'keyboard_p2'
MOBILE = 'mobile'
TOUCHSCREEN = 'touchscreen'

bauiv1lib.settings.devtools module

Dev tools settings, as a doc-ui page.

A client-local doc-ui domain like the other settings pages: the page is authored here, its controls mirror the config in typed page state, and every control is a typed local action.

bauiv1lib.settings.devtools.AnyDevToolsRoute

alias of Root

class bauiv1lib.settings.devtools.ApplyButtonSetting(commit: bool = True)[source]

Bases: DevToolsLocalAction

Write the dev-console-button setting that changed to the config.

commit: bool = True

Save to disk too (a settled value), or just apply (mid-drag).

class bauiv1lib.settings.devtools.ApplyShowButton[source]

Bases: DevToolsLocalAction

Write the show-dev-console-button setting to the config.

class bauiv1lib.settings.devtools.CreateUserSystemScripts[source]

Bases: DevToolsLocalAction

Copy the system scripts out to the user dir for editing.

class bauiv1lib.settings.devtools.DeleteUserSystemScripts[source]

Bases: DevToolsLocalAction

Remove the user copy of the system scripts (after confirming).

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.

class bauiv1lib.settings.devtools.DevConsoleButtonStyle(*values)[source]

Bases: Enum

Color scheme for the dev console button (config values).

GREEN = 'green'
GREY = 'grey'
HOWDY = 'howdy'
PURPLE = 'purple'
class bauiv1lib.settings.devtools.DevToolsController[source]

Bases: TypedDocUIController[Root, ApplyShowButton | ApplyButtonSetting | ResetButton | CreateUserSystemScripts | DeleteUserSystemScripts]

Doc-ui controller for the dev tools page.

fulfill_route(route: AnyDevToolsRoute) → 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[DevToolsLocalAction][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[DevToolsRoute][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: AnyDevToolsLocalAction, 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.settings.devtools.DevToolsLocalAction[source]

Bases: DocUILocalActionBase

Family class for the dev tools 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.settings.devtools.DevToolsRoute[source]

Bases: DocUIRoute

Family class for the dev tools 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.settings.devtools.DevToolsState(show_dev_console_button: bool = False, dev_console_button_size: float = 1.0, dev_console_button_opacity: float = 1.0, dev_console_button_style: DevConsoleButtonStyle = DevConsoleButtonStyle.GREY)[source]

Bases: DocUIState

The page’s values, mirroring the config.

dev_console_button_opacity: float = 1.0
dev_console_button_size: float = 1.0
dev_console_button_style: DevConsoleButtonStyle = 'grey'
show_dev_console_button: bool = False
class bauiv1lib.settings.devtools.ResetButton[source]

Bases: DevToolsLocalAction

Put the dev console button back to its default look and spot.

class bauiv1lib.settings.devtools.Root[source]

Bases: DevToolsRoute

The dev tools page.

bauiv1lib.settings.gamepad module

Settings UI functionality related to gamepads.

class bauiv1lib.settings.gamepad.AwaitGamepadInputWindow(gamepad: InputDevice, button: str, callback: Callable[[str, dict[str, Any], AwaitGamepadInputWindow], Any], message: Lstr | LangStr | None = None, message2: Lstr | LangStr | None = None)[source]

Bases: Window

Window for capturing a gamepad button press.

die() → None[source]

Kill the window.

class bauiv1lib.settings.gamepad.GamepadSettingsWindow(inputdevice: InputDevice, *, modal: bool = False, transition: str | None = 'in_right', transition_out: str = 'out_right', origin_widget: Widget | None = None, settings: dict | None = None)[source]

Bases: MainWindow

Window for configuring a gamepad.

get_advanced_button() → Widget[source]

(internal)

get_auto_recalibrate_analog_stick_value() → bool[source]

(internal)

get_control_value_name(control: str) → str | LangStr[source]

(internal)

get_enable_secondary_value() → bool[source]

(internal)

get_ext() → str[source]

(internal)

get_ignore_completely_value() → bool[source]

(internal)

get_input() → InputDevice[source]

(internal)

get_is_secondary() → bool[source]

(internal)

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.

get_r() → str[source]

(internal)

get_settings() → dict[str, Any][source]

(internal)

get_start_button_activates_default_widget_value() → bool[source]

(internal)

get_ui_only_value() → bool[source]

(internal)

get_unassigned_buttons_run_value() → bool[source]

(internal)

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).

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.

set_auto_recalibrate_analog_stick_value(value: bool) → None[source]

(internal)

set_ignore_completely_value(value: bool) → None[source]

(internal)

set_start_button_activates_default_widget_value(value: bool) → None[source]

(internal)

set_ui_only_value(value: bool) → None[source]

(internal)

set_unassigned_buttons_run_value(value: bool) → None[source]

(internal)

show_secondary_editor() → None[source]

(internal)

bauiv1lib.settings.gamepadadvanced module

UI functionality related to advanced gamepad configuring.

class bauiv1lib.settings.gamepadadvanced.GamepadAdvancedSettingsWindow(parent_window: GamepadSettingsWindow)[source]

Bases: Window

Window for advanced gamepad configuration.

bauiv1lib.settings.gamepadselect module

Settings UI related to gamepad functionality.

class bauiv1lib.settings.gamepadselect.GamepadSelectWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]

Bases: MainWindow

Window for selecting a gamepad to configure.

gamepad_configure_callback(event: dict[str, Any]) → None[source]

Respond to a gamepad button press during config selection.

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.settings.graphics module

Graphics settings, as a doc-ui page.

A client-local doc-ui domain like the audio and advanced settings: the page is authored here, its controls keep their values in typed page state mirroring the config, and each change is a typed local action that writes the config.

Fullscreen is the odd one out: it can change behind the page’s back (a hotkey, the OS window controls), so the controller polls it (see GraphicsSettingsController.poll_page_state()). Its native calls are logic-thread-only while pages are built in the background, so the controller keeps what the page build needs cached.

bauiv1lib.settings.graphics.AnyGraphicsRoute

alias of Root

class bauiv1lib.settings.graphics.ApplyFullscreen[source]

Bases: GraphicsLocalAction

Set fullscreen to what the page’s state holds.

class bauiv1lib.settings.graphics.ApplyMaxFps[source]

Bases: GraphicsLocalAction

Clean up and write the typed max-fps value.

class bauiv1lib.settings.graphics.ApplyResolution[source]

Bases: GraphicsLocalAction

Write the resolution setting in its platform’s form.

class bauiv1lib.settings.graphics.ApplyScreenInsets[source]

Bases: GraphicsLocalAction

Write the screen-insets settings (mode and custom amount).

Switching modes either way resets the custom amount to what automatic uses, so switching to custom doesn’t jump and switching to automatic shows its amount. The custom-amount slider is disabled under automatic, so the page rebuilds on each mode switch.

class bauiv1lib.settings.graphics.ApplySetting[source]

Bases: GraphicsLocalAction

Write the setting that changed (the trigger) to the config.

class bauiv1lib.settings.graphics.AssetQuality(*values)[source]

Bases: Enum

Asset quality tiers.

Display-only for now: the popup shows what’s coming, with ultra disabled, and writes nothing to the config.

REGULAR = 'Regular'
ULTRA = 'Ultra'
class bauiv1lib.settings.graphics.GraphicsLocalAction[source]

Bases: DocUILocalActionBase

Family class for the graphics settings 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.settings.graphics.GraphicsRoute[source]

Bases: DocUIRoute

Family class for the graphics settings 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.settings.graphics.GraphicsSettingsController[source]

Bases: TypedDocUIController[Root, ApplySetting | ApplyFullscreen | ApplyResolution | ApplyMaxFps | ApplyScreenInsets]

Doc-ui controller for the graphics settings page.

fulfill_route(route: AnyGraphicsRoute) → 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[GraphicsLocalAction][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.

get_page_state_poll_interval() → float | None[source]

How often to call poll_page_state() (None = never).

For client-local pages mirroring values that can change behind their back (fullscreen toggled by a hotkey, say). Polling runs while a window shows a page that has state and isn’t waiting on a request.

classmethod get_route_type() → type[GraphicsRoute][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.

poll_page_state(window: DocUIWindow) → dict[source]

Current values for (some of) a window’s page state.

Called every get_page_state_poll_interval() seconds. Return wire-form values keyed as in the state (see bacommon.docui.routes.DocUIState.key()); any differing from what the page holds are pushed into it, updating the controls showing them without rebuilding anything.

run_local_action(action: AnyGraphicsLocalAction, 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.settings.graphics.GraphicsState(fullscreen: bool = False, visuals: Quality = Quality.AUTO, asset_quality: AssetQuality = AssetQuality.REGULAR, resolution: str = '', resolution_scale: float = 1.0, vsync: VSync = VSync.AUTO, msaa: str = 'Auto', max_fps: str = '', show_fps: bool = False, screen_insets: ScreenInsets = ScreenInsets.AUTO, custom_screen_insets: float = 0.0, thermal_throttling: bool = True)[source]

Bases: DocUIState

The page’s values, mirroring the config.

asset_quality: AssetQuality = 'Regular'
custom_screen_insets: float = 0.0

0-1; see ApplyScreenInsets for how it relates to screen_insets.

fullscreen: bool = False
max_fps: str = ''

As typed; cleaned up and written by ApplyMaxFps.

msaa: str = 'Auto'

One of the MSAA popup’s choice values (see _msaa_choices()): ‘Auto’, ‘Off’, or a sample count such as ‘4’.

resolution: str = ''

One of the Android resolution popup’s choice values (see _resolution_choices()).

resolution_scale: float = 1.0

The resolution slider’s scale, for the scale-based modes (see _scale_range()).

screen_insets: ScreenInsets = 'Auto'
show_fps: bool = False
thermal_throttling: bool = True

Whether to drop the frame rate under severe thermal pressure (Android only).

visuals: Quality = 'Auto'
vsync: VSync = 'Auto'
class bauiv1lib.settings.graphics.Quality(*values)[source]

Bases: Enum

Graphics quality settings (their config values).

AUTO = 'Auto'
HIGH = 'High'
HIGHER = 'Higher'
LOW = 'Low'
MEDIUM = 'Medium'
class bauiv1lib.settings.graphics.ResolutionMode(*values)[source]

Bases: Enum

What the resolution control sets on this platform.

ANDROID = 'android'

Sets Resolution (Android) to Auto, Native, or an HD standard.

CARDBOARD = 'cardboard'

Sets GVR Render Target Scale (cardboard VR) on a slider.

PIXEL_SCALE = 'pixel_scale'

Sets Screen Pixel Scale on a slider (for systems that can’t set a resolution directly).

class bauiv1lib.settings.graphics.Root[source]

Bases: GraphicsRoute

The graphics settings page.

class bauiv1lib.settings.graphics.ScreenInsets(*values)[source]

Bases: Enum

Screen-insets settings (their config values).

AUTO = 'Auto'
CUSTOM = 'Custom'
class bauiv1lib.settings.graphics.VSync(*values)[source]

Bases: Enum

Vertical-sync settings (their config values).

ALWAYS = 'Always'
AUTO = 'Auto'
NEVER = 'Never'

bauiv1lib.settings.keyboard module

Keyboard settings related UI functionality.

class bauiv1lib.settings.keyboard.AwaitKeyboardInputWindow(button: str, ui: Widget, settings: dict)[source]

Bases: Window

Window for capturing a keypress.

class bauiv1lib.settings.keyboard.ConfigKeyboardWindow(c: InputDevice, transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]

Bases: MainWindow

Window for configuring keyboards.

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).

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.settings.nettesting module

Provides ui for network related testing.

class bauiv1lib.settings.nettesting.NetTestingWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]

Bases: MainWindow

Window that runs a networking test suite to help diagnose issues.

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).

print(text: str, color: tuple[float, float, float]) → None[source]

Print text to our console thingie.

bauiv1lib.settings.nettesting.get_net_val_testing_window() → TestingWindow[source]

Create a window for testing net values.

bauiv1lib.settings.plugins module

Plugin Window UI.

class bauiv1lib.settings.plugins.Category(*values)[source]

Bases: Enum

Categories we can display.

ALL = 'all'
DISABLED = 'disabled'
ENABLED = 'enabled'
property display: LangStr

Display string for us.

class bauiv1lib.settings.plugins.PluginWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]

Bases: MainWindow

Window for configuring plugins.

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).

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.settings.pluginsettings module

Plugin Settings UI.

class bauiv1lib.settings.pluginsettings.PluginSettingsWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]

Bases: MainWindow

Plugin Settings 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.settings.remoteapp module

Settings UI functionality related to the remote app.

class bauiv1lib.settings.remoteapp.RemoteAppSettingsWindow(transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]

Bases: MainWindow

Window showing info/settings related to the remote 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.settings.testing module

Provides UI for test settings.

class bauiv1lib.settings.testing.TestingWindow(title: Lstr | LangStr, entries: list[dict[str, Any]], transition: str | None = 'in_right', origin_widget: Widget | None = None)[source]

Bases: MainWindow

Window for conveniently testing various settings.

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.

bauiv1lib.settings.touchscreen module

Touchscreen control settings, as a doc-ui page.

A client-local doc-ui domain like the other settings pages: the settings live in typed page state mirroring the config, and each change is a typed local action writing it. While a window showing the page is up, the touch controls themselves are in editing mode, so they can be dragged around behind it.

class bauiv1lib.settings.touchscreen.ActionType(*values)[source]

Bases: Enum

How actions are triggered (the config’s values).

BUTTONS = 'buttons'
SWIPE = 'swipe'
bauiv1lib.settings.touchscreen.AnyTouchscreenRoute

alias of Root

class bauiv1lib.settings.touchscreen.ApplySetting(commit: bool = True)[source]

Bases: TouchscreenLocalAction

Write the setting that changed (the trigger) to the config.

commit: bool = True

Save to disk too (a settled value), or just apply (mid-drag).

class bauiv1lib.settings.touchscreen.MovementType(*values)[source]

Bases: Enum

How movement is controlled (the config’s values).

JOYSTICK = 'joystick'
SWIPE = 'swipe'
class bauiv1lib.settings.touchscreen.Reset[source]

Bases: TouchscreenLocalAction

Put every touch control setting (and position) back to default.

class bauiv1lib.settings.touchscreen.Root[source]

Bases: TouchscreenRoute

The touchscreen settings page.

class bauiv1lib.settings.touchscreen.TouchscreenLocalAction[source]

Bases: DocUILocalActionBase

Family class for the touchscreen settings 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.settings.touchscreen.TouchscreenRoute[source]

Bases: DocUIRoute

Family class for the touchscreen settings 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.settings.touchscreen.TouchscreenSettingsController[source]

Bases: TypedDocUIController[Root, ApplySetting | Reset]

Doc-ui controller for the touchscreen settings page.

create_window(request: DocUIRequest | DocUIRoute, *, transition: str | None = 'in_right', origin_widget: bui.Widget | None = None, auxiliary_style: bool = True, uiopenstateid: str | None = None, suppress_win_extra_type_warning: bool = False, options: WindowOptions | None = None) → DocUIWindow[source]

Create a new window to handle a request.

The window opens as options say; anything they leave unset comes from a route’s own defaults (its get_window_layout() and such), or else the general defaults (see WindowOptions).

fulfill_route(route: AnyTouchscreenRoute) → 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[TouchscreenLocalAction][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[TouchscreenRoute][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.

restore(win: DocUIWindow, *, last_response: DocUIResponse | None, has_had_response: bool) → DocUIWindow[source]

Restore a window from previous state.

May immediately display old results or may kick off a new request.

run_local_action(action: AnyTouchscreenLocalAction, 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.settings.touchscreen.TouchscreenState(movement: MovementType = MovementType.SWIPE, movement_scale: float = 1.0, actions: ActionType = ActionType.BUTTONS, actions_scale: float = 1.0, swipe_hidden: bool = False, haptics: bool = True)[source]

Bases: DocUIState

The page’s values, mirroring the config.

actions: ActionType = 'buttons'
actions_scale: float = 1.0
haptics: bool = True
movement: MovementType = 'swipe'
movement_scale: float = 1.0
swipe_hidden: bool = False

bauiv1lib.settings.vrtesting module

Provides UI for testing vr settings.

class bauiv1lib.settings.vrtesting.VRTestingWindow(transition: str = 'in_right')[source]

Bases: TestingWindow

Window for testing vr settings.