Source code for _bauiv1

# Released under the MIT License. See LICENSE for details.
#
"""A dummy stub module for the real _bauiv1.

The real _bauiv1 is a compiled extension module and only available
in the live engine. This dummy-module allows Pylint/Mypy/etc. to
function reasonably well outside of that environment.

Make sure this file is never included in dirs seen by the engine!

In the future perhaps this can be a stub (.pyi) file, but we will need
to make sure that it works with all our tools (mypy, pylint, pycharm).

NOTE: This file was autogenerated by batools.dummymodule; do not edit by hand.
"""

# I'm sorry Pylint. I know this file saddens you. Be strong.
# pylint: disable=useless-suppression
# pylint: disable=unnecessary-pass
# pylint: disable=use-dict-literal
# pylint: disable=use-list-literal
# pylint: disable=unused-argument
# pylint: disable=missing-docstring
# pylint: disable=too-many-locals
# pylint: disable=redefined-builtin
# pylint: disable=too-many-lines
# pylint: disable=redefined-outer-name
# pylint: disable=invalid-name
# pylint: disable=no-value-for-parameter
# pylint: disable=unused-import
# pylint: disable=too-many-positional-arguments

from __future__ import annotations

from typing import TYPE_CHECKING, override

if TYPE_CHECKING:
    from typing import Any, Callable, Literal, Sequence
    import babase
    import bauiv1


def _uninferrable() -> Any:
    """Get an "Any" in mypy and "uninferrable" in Pylint."""
    # pylint: disable=undefined-variable
    return _not_a_real_variable  # type: ignore


[docs] class Mesh: """Mesh asset for local user interface purposes.""" pass
[docs] class Sound: """Sound asset for local user interface purposes."""
[docs] def play(self, volume: float = 1.0) -> None: """Play the sound locally.""" # This is a dummy stub; the actual implementation is native code. return None
[docs] def stop(self) -> None: """Stop the sound if it is playing.""" # This is a dummy stub; the actual implementation is native code. return None
[docs] class Texture: """Texture asset for local user interface purposes.""" pass
[docs] class Widget: """Internal type for low level UI elements; buttons, windows, etc. This class represents a weak reference to a widget object in the internal C++ layer. Currently, functions such as bauiv1.buttonwidget() must be used to instantiate or edit these. """ #: Whether this widget is in the process of dying (read only). #: #: It can be useful to check this on a window's root widget to #: prevent multiple window actions from firing simultaneously, #: potentially leaving the UI in a broken state. transitioning_out: bool def __bool__(self) -> bool: """Support for bool evaluation.""" return bool(True) # Slight obfuscation.
[docs] def activate(self) -> None: """Activates a widget; the same as if it had been clicked.""" # This is a dummy stub; the actual implementation is native code. return None
[docs] def add_delete_callback(self, call: Callable) -> None: """Add a call to be run immediately after this widget is destroyed.""" # This is a dummy stub; the actual implementation is native code. return None
[docs] def delete(self, ignore_missing: bool = True) -> None: """Delete the Widget. Ignores already-deleted Widgets if ignore_missing is True; otherwise an Exception is thrown. """ # This is a dummy stub; the actual implementation is native code. return None
[docs] def exists(self) -> bool: """Returns whether the Widget still exists. Most functionality will fail on a nonexistent widget. Note that you can also use the boolean operator for this same functionality, so a statement such as "if mywidget" will do the right thing both for Widget objects and values of None. """ # This is a dummy stub; the actual implementation is native code. return bool()
[docs] def get_children(self) -> list[bauiv1.Widget]: """Returns any child Widgets of this Widget.""" # This is a dummy stub; the actual implementation is native code. import bauiv1 return [bauiv1.Widget()]
[docs] def get_screen_space_center(self) -> tuple[float, float]: """Returns the coords of the bauiv1.Widget center relative to the center of the screen. This can be useful for placing pop-up windows and other special cases. """ # This is a dummy stub; the actual implementation is native code. return (0.0, 0.0)
[docs] def get_selected_child(self) -> bauiv1.Widget | None: """Returns the selected child Widget or None if nothing is selected.""" # This is a dummy stub; the actual implementation is native code. import bauiv1 return bauiv1.Widget()
[docs] def get_widget_type(self) -> str: """Return the internal type of the Widget as a string. Note that this is different from the Python bauiv1.Widget type, which is the same for all widgets. """ # This is a dummy stub; the actual implementation is native code. return str()
[docs] def buttonwidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, id: str | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, on_activate_call: Callable | None = None, label: str | bauiv1.Lstr | None = None, color: Sequence[float] | None = None, down_widget: bauiv1.Widget | None = None, up_widget: bauiv1.Widget | None = None, left_widget: bauiv1.Widget | None = None, right_widget: bauiv1.Widget | None = None, texture: bauiv1.Texture | None = None, text_scale: float | None = None, textcolor: Sequence[float] | None = None, enable_sound: bool | None = None, mesh_transparent: bauiv1.Mesh | None = None, mesh_opaque: bauiv1.Mesh | None = None, repeat: bool | None = None, scale: float | None = None, transition_delay: float | None = None, on_select_call: Callable | None = None, button_type: str | None = None, extra_touch_border_scale: float | None = None, selectable: bool | None = None, show_buffer_top: float | None = None, icon: bauiv1.Texture | None = None, iconscale: float | None = None, icon_tint: float | None = None, icon_color: Sequence[float] | None = None, autoselect: bool | None = None, mask_texture: bauiv1.Texture | None = None, tint_texture: bauiv1.Texture | None = None, tint_color: Sequence[float] | None = None, tint2_color: Sequence[float] | None = None, text_flatness: float | None = None, text_res_scale: float | None = None, enabled: bool | None = None, ) -> bauiv1.Widget: """Create or edit a button widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def checkboxwidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, text: str | bauiv1.Lstr | None = None, value: bool | None = None, on_value_change_call: Callable[[bool], None] | None = None, on_select_call: Callable[[], None] | None = None, text_scale: float | None = None, textcolor: Sequence[float] | None = None, scale: float | None = None, is_radio_button: bool | None = None, maxwidth: float | None = None, autoselect: bool | None = None, color: Sequence[float] | None = None, ) -> bauiv1.Widget: """Create or edit a check-box widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def columnwidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, background: bool | None = None, selected_child: bauiv1.Widget | None = None, visible_child: bauiv1.Widget | None = None, single_depth: bool | None = None, print_list_exit_instructions: bool | None = None, left_border: float | None = None, top_border: float | None = None, bottom_border: float | None = None, selection_loops_to_parent: bool | None = None, border: float | None = None, margin: float | None = None, claims_left_right: bool | None = None, ) -> bauiv1.Widget: """Create or edit a column widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def containerwidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, id: str | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, background: bool | None = None, selected_child: bauiv1.Widget | None = None, transition: str | None = None, cancel_button: bauiv1.Widget | None = None, start_button: bauiv1.Widget | None = None, root_selectable: bool | None = None, on_activate_call: Callable[[], None] | None = None, claims_left_right: bool | None = None, selection_loops: bool | None = None, selection_loops_to_parent: bool | None = None, scale: float | None = None, on_outside_click_call: Callable[[], None] | None = None, single_depth: bool | None = None, visible_child: bauiv1.Widget | None = None, stack_offset: Sequence[float] | None = None, color: Sequence[float] | None = None, on_cancel_call: Callable[[], None] | None = None, print_list_exit_instructions: bool | None = None, click_activate: bool | None = None, always_highlight: bool | None = None, selectable: bool | None = None, scale_origin_stack_offset: Sequence[float] | None = None, toolbar_visibility: ( Literal[ 'menu_minimal', 'menu_minimal_no_back', 'menu_full', 'menu_full_no_back', 'menu_store', 'menu_store_no_back', 'menu_in_game', 'menu_tokens', 'get_tokens', 'no_menu_minimal', 'inherit', ] | None ) = None, on_select_call: Callable[[], None] | None = None, claim_outside_clicks: bool | None = None, claims_up_down: bool | None = None, ) -> bauiv1.Widget: """Create or edit a container widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def get_qrcode_texture(url: str) -> bauiv1.Texture: """Return a QR code texture. The provided url must be 64 bytes or less. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Texture()
[docs] def get_special_widget( name: Literal[ 'squad_button', 'back_button', 'account_button', 'achievements_button', 'settings_button', 'inbox_button', 'store_button', 'get_tokens_button', 'inventory_button', 'tickets_meter', 'tokens_meter', 'trophy_meter', 'level_meter', 'overlay_stack', 'chest_0_button', 'chest_1_button', 'chest_2_button', 'chest_3_button', ], ) -> bauiv1.Widget: """(internal)""" # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def getmesh(name: str) -> bauiv1.Mesh: """Load a mesh for use solely in the local user interface.""" # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Mesh()
[docs] def getsound(name: str) -> bauiv1.Sound: """Load a sound for use in the ui.""" # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Sound()
[docs] def gettexture(name: str) -> bauiv1.Texture: """Load a texture for use in the ui.""" # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Texture()
[docs] def hscrollwidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, background: bool | None = None, selected_child: bauiv1.Widget | None = None, capture_arrows: bool | None = None, on_select_call: Callable[[], None] | None = None, center_small_content: bool | None = None, color: Sequence[float] | None = None, highlight: bool | None = None, border_opacity: float | None = None, simple_culling_h: float | None = None, claims_left_right: bool | None = None, claims_up_down: bool | None = None, ) -> bauiv1.Widget: """Create or edit a horizontal scroll widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def imagewidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, color: Sequence[float] | None = None, texture: bauiv1.Texture | None = None, opacity: float | None = None, mesh_transparent: bauiv1.Mesh | None = None, mesh_opaque: bauiv1.Mesh | None = None, has_alpha_channel: bool = True, tint_texture: bauiv1.Texture | None = None, tint_color: Sequence[float] | None = None, transition_delay: float | None = None, draw_controller: bauiv1.Widget | None = None, tint2_color: Sequence[float] | None = None, tilt_scale: float | None = None, mask_texture: bauiv1.Texture | None = None, radial_amount: float | None = None, draw_controller_mult: float | None = None, ) -> bauiv1.Widget: """Create or edit an image widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
def is_available() -> bool: """(internal)""" # This is a dummy stub; the actual implementation is native code. return bool() def on_ui_scale_change() -> None: """(internal)""" # This is a dummy stub; the actual implementation is native code. return None def root_ui_back_press() -> None: """(internal)""" # This is a dummy stub; the actual implementation is native code. return None
[docs] def root_ui_pause_updates() -> None: """Temporarily pause updates to the root ui for animation purposes. Make sure that each call to this is matched by a call to root_ui_resume_updates(). """ # This is a dummy stub; the actual implementation is native code. return None
[docs] def root_ui_resume_updates() -> None: """Resume paused updates to the root ui for animation purposes.""" # This is a dummy stub; the actual implementation is native code. return None
[docs] def rowwidget( edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, background: bool | None = None, selected_child: bauiv1.Widget | None = None, visible_child: bauiv1.Widget | None = None, claims_left_right: bool | None = None, selection_loops_to_parent: bool | None = None, ) -> bauiv1.Widget: """Create or edit a row widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def scrollwidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, background: bool | None = None, selected_child: bauiv1.Widget | None = None, capture_arrows: bool = False, on_select_call: Callable | None = None, center_small_content: bool | None = None, center_small_content_horizontally: bool | None = None, color: Sequence[float] | None = None, highlight: bool | None = None, border_opacity: float | None = None, simple_culling_v: float | None = None, selection_loops_to_parent: bool | None = None, claims_left_right: bool | None = None, claims_up_down: bool | None = None, autoselect: bool | None = None, ) -> bauiv1.Widget: """Create or edit a scroll widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def set_party_window_open(value: bool) -> None: """(internal)""" # This is a dummy stub; the actual implementation is native code. return None
[docs] def spinnerwidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: float | None = None, position: Sequence[float] | None = None, style: Literal['bomb', 'simple'] | None = None, visible: bool | None = None, ) -> bauiv1.Widget: """Create or edit a spinner widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def textwidget( *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, text: str | bauiv1.Lstr | None = None, v_align: str | None = None, h_align: str | None = None, editable: bool | None = None, padding: float | None = None, on_return_press_call: Callable[[], None] | None = None, on_activate_call: Callable[[], None] | None = None, selectable: bool | None = None, query: bauiv1.Widget | None = None, max_chars: int | None = None, color: Sequence[float] | None = None, click_activate: bool | None = None, on_select_call: Callable[[], None] | None = None, always_highlight: bool | None = None, draw_controller: bauiv1.Widget | None = None, scale: float | None = None, corner_scale: float | None = None, description: str | bauiv1.Lstr | None = None, transition_delay: float | None = None, maxwidth: float | None = None, max_height: float | None = None, flatness: float | None = None, shadow: float | None = None, autoselect: bool | None = None, rotate: float | None = None, enabled: bool | None = None, force_internal_editing: bool | None = None, always_show_carat: bool | None = None, big: bool | None = None, extra_touch_border_scale: float | None = None, res_scale: float | None = None, query_max_chars: bauiv1.Widget | None = None, query_description: bauiv1.Widget | None = None, adapter_finished: bool | None = None, glow_type: str | None = None, allow_clear_button: bool | None = None, ) -> bauiv1.Widget: """Create or edit a text widget. Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget()
[docs] def uibounds() -> tuple[float, float, float, float]: """(internal) Returns a tuple of 4 values: (x-min, x-max, y-min, y-max) representing the range of values that can be plugged into a root level bauiv1.ContainerWidget's stack_offset value while guaranteeing that its center remains onscreen. """ # This is a dummy stub; the actual implementation is native code. return (0.0, 0.0, 0.0, 0.0)
[docs] def widget( *, edit: bauiv1.Widget, up_widget: bauiv1.Widget | None = None, down_widget: bauiv1.Widget | None = None, left_widget: bauiv1.Widget | None = None, right_widget: bauiv1.Widget | None = None, show_buffer_top: float | None = None, show_buffer_bottom: float | None = None, show_buffer_left: float | None = None, show_buffer_right: float | None = None, depth_range: tuple[float, float] | None = None, autoselect: bool | None = None, ) -> None: """Edit common attributes of any widget. Unlike other UI calls, this can only be used to edit, not to create. """ # This is a dummy stub; the actual implementation is native code. return None
# Docs-generation hack; import some stuff that we likely only forward-declared # in our actual source code so that docs tools can find it. from typing import (Coroutine, Any, Literal, Callable, Generator, Awaitable, Sequence, Self) import asyncio from concurrent.futures import Future from pathlib import Path from enum import Enum