UI code cleanup

This commit is contained in:
Eric Froemling 2020-07-21 03:05:51 -07:00
parent e0d0c1d3d4
commit f5b179395f
28 changed files with 267 additions and 212 deletions

View File

@ -4135,16 +4135,16 @@
"assets/build/windows/x64/vc_redist.x64.exe": "https://files.ballistica.net/cache/ba1/ea/19/8b8787d81abcdce158ba608cd24f",
"assets/build/windows/x64/vcruntime140_1d.dll": "https://files.ballistica.net/cache/ba1/11/d8/ff6344b429b00c24d9a1930d4338",
"assets/build/windows/x64/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/20/33/0825e11e6518f87ece3009309933",
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/94/36/dd75b60256df2a060729decce0f7",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c3/38/cce780c715451caaa5f6cf4516ae",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/35/ba/774fac4f532434c20d90debb24be",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/86/a2/b026c303f1da34dcdaeceb9bad24",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/78/a3/52f50bd0b158c8765ebfbd95fb7b",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/70/43/0ab510f023e0a571e481b1194a0a",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/e7/d0/2a07066094977585b7adc266ef86",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a9/b4/e4d542e791e43e00d886c5a2cd72",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/8c/9a/9374664002b627493acb68a58d0f",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/31/a0/2e3391873c37f223bcedb191d0f2",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/20/57/f3a7e9f9443f193aba02bba7c463",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/36/ba/6323c8132892fbc06ba5a0aa202c"
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b6/f3/a034a7393edf52eefe644e6aa642",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5d/e2/c45ee46dc39c32aa4bff0d50ef2c",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/25/3d/f3cce76ed1c66e39b6e07d199696",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/cf/8b/5c09d999c0d6b160e34d69f1f710",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c7/b6/18b0280b4c99aaf48fb3bfcc4fac",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/c4/65/dd50a2026be7df75e3d280a2efc3",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/62/4e/f6a184076ad4676ad6b4cf9d4d01",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/20/d9/f86cd5d9fb67183e0a2ceda0e897",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/e4/da/0b43bb125048696f4514eaca1e56",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/d6/46/d0e647509453bc2125ccbe7eba09",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/c2/a8/fee89fe0a3d76489b5b26a2c5fac",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/70/d5/86c8bdb5cf1dd15d9b9a0c7490da"
}

View File

@ -1451,6 +1451,7 @@
<w>plistname</w>
<w>plpt</w>
<w>plst</w>
<w>pluglist</w>
<w>plusbutton</w>
<w>plvel</w>
<w>pmats</w>

View File

@ -2,6 +2,14 @@
- Fixed the shebang line in `bombsquad_server` file by using `-S` flag for `/usr/bin/env`.
- Fixed a bug with hardware keyboards emitting extra characters in the in-game console (~ or F2)
- Added support for 'plugin' mods and user controls to configure them in settings->advanced->plugins.
- renamed selection_loop_to_parent to selection_loops_to_parent in widget calls.
- Added 'selection_loops_to_parent', 'border', 'margin', 'claims_left_right', and 'claims_tab' args to ba.columnwidget().
- Column-widget now has a default 'border' of 0 (explicitly pass 2 to get the old look).
- Column-widget now has a default 'margin' of 10 (explicitly pass 0 to get the old look).
- Added 'selection_loops_to_parent', 'claims_left_right', and 'claims_tab' args to ba.scrollwidget.
- Added 'selection_loops_to_parent', 'claims_left_right', and 'claims_tab' args to ba.rowwidget.
- Added 'claims_left_right' and 'claims_tab' to ba.hscrollwidget().
- Default widget 'show_buffer' is now 20 instead of 0 (causes scrolling to stay slightly ahead of widget selection). This can be overridden with the ba.widget() call if anything breaks.
### 1.5.22 (20139)
- Button and key names now display correctly again on Android (and are cleaned up on other platforms too).

View File

@ -1598,7 +1598,12 @@ def columnwidget(edit: ba.Widget = None,
print_list_exit_instructions: bool = None,
left_border: float = None,
top_border: float = None,
bottom_border: float = None) -> ba.Widget:
bottom_border: float = None,
selection_loops_to_parent: bool = None,
border: float = None,
margin: float = None,
claims_left_right: bool = None,
claims_tab: bool = None) -> ba.Widget:
"""columnwidget(edit: ba.Widget = None,
parent: ba.Widget = None,
size: Sequence[float] = None,
@ -1610,7 +1615,12 @@ def columnwidget(edit: ba.Widget = None,
print_list_exit_instructions: bool = None,
left_border: float = None,
top_border: float = None,
bottom_border: float = None) -> ba.Widget
bottom_border: float = None,
selection_loops_to_parent: bool = None,
border: float = None,
margin: float = None,
claims_left_right: bool = None,
claims_tab: bool = None) -> ba.Widget
Create or edit a column widget.
@ -1669,7 +1679,7 @@ def containerwidget(edit: ba.Widget = None,
claims_left_right: bool = None,
claims_tab: bool = None,
selection_loops: bool = None,
selection_loop_to_parent: bool = None,
selection_loops_to_parent: bool = None,
scale: float = None,
on_outside_click_call: Callable[[], None] = None,
single_depth: bool = None,
@ -1700,7 +1710,7 @@ def containerwidget(edit: ba.Widget = None,
claims_left_right: bool = None,
claims_tab: bool = None,
selection_loops: bool = None,
selection_loop_to_parent: bool = None,
selection_loops_to_parent: bool = None,
scale: float = None,
on_outside_click_call: Callable[[], None] = None,
single_depth: bool = None,
@ -2618,7 +2628,9 @@ def hscrollwidget(edit: ba.Widget = None,
color: Sequence[float] = None,
highlight: bool = None,
border_opacity: float = None,
simple_culling_h: float = None) -> ba.Widget:
simple_culling_h: float = None,
claims_left_right: bool = None,
claims_tab: bool = None) -> ba.Widget:
"""hscrollwidget(edit: ba.Widget = None, parent: ba.Widget = None,
size: Sequence[float] = None, position: Sequence[float] = None,
background: bool = None, selected_child: ba.Widget = None,
@ -2626,7 +2638,9 @@ def hscrollwidget(edit: ba.Widget = None,
on_select_call: Callable[[], None] = None,
center_small_content: bool = None, color: Sequence[float] = None,
highlight: bool = None, border_opacity: float = None,
simple_culling_h: float = None) -> ba.Widget
simple_culling_h: float = None,
claims_left_right: bool = None,
claims_tab: bool = None) -> ba.Widget
Create or edit a horizontal scroll widget.
@ -3283,12 +3297,18 @@ def rowwidget(edit: Widget = None,
position: Sequence[float] = None,
background: bool = None,
selected_child: Widget = None,
visible_child: Widget = None) -> Widget:
"""rowwidget(edit: Widget =None, parent: Widget =None,
visible_child: Widget = None,
claims_left_right: bool = None,
claims_tab: bool = None,
selection_loops_to_parent: bool = None) -> Widget:
"""rowwidget(edit: Widget = None, parent: Widget = None,
size: Sequence[float] = None,
position: Sequence[float] = None,
background: bool = None, selected_child: Widget = None,
visible_child: Widget = None) -> Widget
visible_child: Widget = None,
claims_left_right: bool = None,
claims_tab: bool = None,
selection_loops_to_parent: bool = None) -> Widget
Create or edit a row widget.
@ -3365,14 +3385,20 @@ def scrollwidget(edit: ba.Widget = None,
color: Sequence[float] = None,
highlight: bool = None,
border_opacity: float = None,
simple_culling_v: float = None) -> ba.Widget:
simple_culling_v: float = None,
selection_loops_to_parent: bool = None,
claims_left_right: bool = None,
claims_tab: bool = None) -> ba.Widget:
"""scrollwidget(edit: ba.Widget = None, parent: ba.Widget = None,
size: Sequence[float] = None, position: Sequence[float] = None,
background: bool = None, selected_child: ba.Widget = None,
capture_arrows: bool = False, on_select_call: Callable = None,
center_small_content: bool = None, color: Sequence[float] = None,
highlight: bool = None, border_opacity: float = None,
simple_culling_v: float = None) -> ba.Widget
simple_culling_v: float = None,
selection_loops_to_parent: bool = None,
claims_left_right: bool = None,
claims_tab: bool = None) -> ba.Widget
Create or edit a scroll widget.

View File

@ -150,7 +150,10 @@ class AccountSettingsWindow(ba.Window):
highlight=False,
position=((self._width - self._scroll_width) * 0.5,
self._height - 65 - self._scroll_height),
size=(self._scroll_width, self._scroll_height))
size=(self._scroll_width, self._scroll_height),
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
self._subcontainer: Optional[ba.Widget] = None
self._refresh()
self._restore_state()
@ -322,15 +325,10 @@ class AccountSettingsWindow(ba.Window):
self._subcontainer = ba.containerwidget(parent=self._scrollwidget,
size=(self._sub_width,
self._sub_height),
background=False)
ba.containerwidget(edit=self._scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
ba.containerwidget(edit=self._subcontainer,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
background=False,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
first_selectable = None
v = self._sub_height - 10.0

View File

@ -91,6 +91,8 @@ class AccountUnlinkWindow(ba.Window):
size=(self._scroll_width, self._scroll_height))
ba.containerwidget(edit=self._scrollwidget, claims_left_right=True)
self._columnwidget = ba.columnwidget(parent=self._scrollwidget,
border=2,
margin=0,
left_border=10)
our_login_id = _ba.get_public_login_id()

View File

@ -245,7 +245,10 @@ class CoopBrowserWindow(ba.Window):
position=(65 + x_inset, 120) if uiscale is ba.UIScale.SMALL
and app.ui.use_toolbars else (65 + x_inset, 70),
size=(self._scroll_width, self._scroll_height),
simple_culling_v=10.0)
simple_culling_v=10.0,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
self._subcontainer: Optional[ba.Widget] = None
# Take note of our account state; we'll refresh later if this changes.
@ -792,17 +795,11 @@ class CoopBrowserWindow(ba.Window):
self._subcontainer = ba.containerwidget(
parent=self._scrollwidget,
size=(self._subcontainerwidth, self._subcontainerheight),
background=False)
background=False,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
# So we can still select root level widgets with controllers.
ba.containerwidget(edit=self._scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
ba.containerwidget(edit=self._subcontainer,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
ba.containerwidget(edit=self._root_widget,
selected_child=self._scrollwidget)
if self._back_button is not None:

View File

@ -356,7 +356,7 @@ class GatherWindow(ba.Window):
(self._scroll_height - c_height) * 0.5),
size=(c_width, c_height),
background=False,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
v = c_height - 30.0
ba.textwidget(
parent=cnt,
@ -378,7 +378,7 @@ class GatherWindow(ba.Window):
(self._scroll_height - c_height) * 0.5),
size=(c_width, c_height),
background=False,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
v = c_height - 30
self._internet_join_text = txt = ba.textwidget(
parent=cnt,
@ -479,7 +479,10 @@ class GatherWindow(ba.Window):
self._scrollwidget = scrollwidget
self._tab_button = tab_button
self._columnwidget = ba.columnwidget(
parent=self._scrollwidget, left_border=10)
parent=self._scrollwidget,
border=2,
margin=0,
left_border=10)
ba.widget(edit=self._columnwidget, up_widget=tab_button)
self._width = width
self._last_selected_host: Optional[Dict[str, Any]] = None
@ -540,7 +543,7 @@ class GatherWindow(ba.Window):
(self._scroll_height - c_height) * 0.5),
size=(c_width, c_height),
background=False,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
v = c_height - 30
ba.textwidget(parent=cnt,
position=(c_width * 0.5, v - 3),
@ -578,7 +581,7 @@ class GatherWindow(ba.Window):
(self._scroll_height - c_height) * 0.5),
size=(c_width, c_height),
background=False,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
v = c_height - 30
ba.textwidget(parent=cnt,
position=(c_width * 0.5, v),
@ -631,7 +634,7 @@ class GatherWindow(ba.Window):
(self._scroll_height - c_height) * 0.5),
size=(c_width, c_height),
background=False,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
v = c_height - 80
ba.textwidget(parent=cnt,
@ -684,7 +687,7 @@ class GatherWindow(ba.Window):
(self._scroll_height - c_height) * 0.5),
size=(c_width, c_height),
background=False,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
v = c_height - 30
ba.textwidget(parent=cnt,
position=(c_width * 0.5, v),

View File

@ -36,12 +36,12 @@ class KioskWindow(ba.Window):
def __init__(self, transition: str = 'in_right'):
# pylint: disable=too-many-locals, too-many-statements
from bastd.ui import confirm
from bastd.ui.confirm import QuitWindow
self._width = 720.0
self._height = 340.0
def _do_cancel() -> None:
confirm.QuitWindow(swish=True, back=True)
QuitWindow(swish=True, back=True)
super().__init__(
root_widget=ba.containerwidget(size=(self._width, self._height),

View File

@ -146,7 +146,7 @@ class MainMenuWindow(ba.Window):
# Don't refresh for the first few seconds the game is up so we don't
# interrupt the transition in.
ba.app.main_menu_window_refresh_check_count += 1
if ba.app.main_menu_window_refresh_check_count < 3:
if ba.app.main_menu_window_refresh_check_count < 4:
return
store_char_tex = self._get_store_char_tex()

View File

@ -119,7 +119,9 @@ class PartyWindow(ba.Window):
self._height - 200),
position=(30, 80),
color=(0.4, 0.6, 0.3))
self._columnwidget = ba.columnwidget(parent=self._scrollwidget)
self._columnwidget = ba.columnwidget(parent=self._scrollwidget,
border=2,
margin=0)
ba.widget(edit=self._menu_button, down_widget=self._columnwidget)
self._muted_text = ba.textwidget(

View File

@ -143,7 +143,9 @@ class PlaylistAddGameWindow(ba.Window):
if self._column is not None:
self._column.delete()
self._column = ba.columnwidget(parent=self._scrollwidget)
self._column = ba.columnwidget(parent=self._scrollwidget,
border=2,
margin=0)
gametypes = [
gt for gt in get_game_types() if gt.supports_session_type(

View File

@ -228,7 +228,9 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
self._scroll_height + 10),
highlight=False)
ba.widget(edit=back_button, right_widget=scrollwidget)
self._columnwidget = ba.columnwidget(parent=scrollwidget)
self._columnwidget = ba.columnwidget(parent=scrollwidget,
border=2,
margin=0)
h = 145

View File

@ -214,7 +214,9 @@ class PlaylistEditWindow(ba.Window):
ba.widget(edit=scrollwidget,
left_widget=add_game_button,
right_widget=scrollwidget)
self._columnwidget = ba.columnwidget(parent=scrollwidget)
self._columnwidget = ba.columnwidget(parent=scrollwidget,
border=2,
margin=0)
ba.widget(edit=self._columnwidget, up_widget=self._text_field)
for button in [add_game_button, edit_game_button, remove_game_button]:

View File

@ -177,22 +177,17 @@ class PlaylistEditGameWindow(ba.Window):
position=(44 + x_inset,
35 + y_extra),
size=(scroll_width, height - 116),
highlight=False)
self._subcontainer = cnt = ba.containerwidget(
parent=self._scrollwidget,
size=(scroll_width, scroll_height),
background=False)
# So selection loops through everything and doesn't get stuck in
# sub-containers.
ba.containerwidget(edit=self._scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
ba.containerwidget(edit=cnt,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
highlight=False,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
self._subcontainer = ba.containerwidget(parent=self._scrollwidget,
size=(scroll_width,
scroll_height),
background=False,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
v = scroll_height - 5
h = -40

View File

@ -199,14 +199,18 @@ class PopupMenuWindow(PopupWindow):
color=(0.35, 0.55, 0.15),
size=(self._width - 40,
self._height - 40))
self._columnwidget = ba.columnwidget(parent=self._scrollwidget)
self._columnwidget = ba.columnwidget(parent=self._scrollwidget,
border=2,
margin=0)
else:
self._offset_widget = ba.containerwidget(parent=self.root_widget,
position=(30, 15),
size=(self._width - 40,
self._height),
background=False)
self._columnwidget = ba.columnwidget(parent=self._offset_widget)
self._columnwidget = ba.columnwidget(parent=self._offset_widget,
border=2,
margin=0)
for index, choice in enumerate(choices):
if len(choices_display_fin) == len(choices):
choice_display_name = choices_display_fin[index]

View File

@ -177,7 +177,9 @@ class ProfileBrowserWindow(ba.Window):
left_widget=self._new_button)
ba.containerwidget(edit=self._root_widget,
selected_child=self._scrollwidget)
self._columnwidget = ba.columnwidget(parent=self._scrollwidget)
self._columnwidget = ba.columnwidget(parent=self._scrollwidget,
border=2,
margin=0)
v -= 255
self._profiles: Optional[Dict[str, Dict[str, Any]]] = None
self._selected_profile = selected_profile

View File

@ -146,14 +146,14 @@ class AdvancedSettingsWindow(ba.Window):
simple_culling_v=20.0,
highlight=False,
size=(self._scroll_width,
self._scroll_height))
ba.containerwidget(edit=self._scrollwidget,
selection_loop_to_parent=True)
self._scroll_height),
selection_loops_to_parent=True)
ba.widget(edit=self._scrollwidget, right_widget=self._scrollwidget)
self._subcontainer = ba.containerwidget(parent=self._scrollwidget,
size=(self._sub_width,
self._sub_height),
background=False,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
self._rebuild()
@ -693,10 +693,10 @@ class AdvancedSettingsWindow(ba.Window):
sel = self._language_inform_checkbox
else:
sel = None
if sel is not None:
ba.containerwidget(edit=self._subcontainer,
selected_child=sel,
visible_child=sel)
if sel is not None:
ba.containerwidget(edit=self._subcontainer,
selected_child=sel,
visible_child=sel)
except Exception:
ba.print_exception(f'Error restoring state for {self.__class__}')

View File

@ -89,19 +89,17 @@ class GamepadAdvancedSettingsWindow(ba.Window):
parent=self._root_widget,
position=((self._width - self._scroll_width) * 0.5,
self._height - 65 - self._scroll_height),
size=(self._scroll_width, self._scroll_height))
size=(self._scroll_width, self._scroll_height),
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
self._subcontainer = ba.containerwidget(parent=self._scrollwidget,
size=(self._sub_width,
self._sub_height),
background=False)
ba.containerwidget(edit=self._scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
ba.containerwidget(edit=self._subcontainer,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
background=False,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
ba.containerwidget(edit=self._root_widget,
selected_child=self._scrollwidget)

View File

@ -105,23 +105,35 @@ class PluginSettingsWindow(ba.Window):
simple_culling_v=20.0,
highlight=False,
size=(self._scroll_width,
self._scroll_height))
ba.containerwidget(edit=self._scrollwidget,
selection_loop_to_parent=True)
self._subcontainer = ba.containerwidget(parent=self._scrollwidget,
size=(self._sub_width,
self._sub_height),
background=False,
selection_loop_to_parent=True)
self._scroll_height),
selection_loops_to_parent=True)
ba.widget(edit=self._scrollwidget, right_widget=self._scrollwidget)
self._subcontainer = ba.columnwidget(parent=self._scrollwidget,
selection_loops_to_parent=True)
pluglist = [f'Test {i}' for i in range(10)]
for i, plug in enumerate(pluglist):
check = ba.checkboxwidget(parent=self._subcontainer,
text=plug,
size=(self._scroll_width - 40, 50))
# Make sure we scroll all the way to the end when using
# keyboard/button nav.
ba.widget(edit=check, show_buffer_top=40, show_buffer_bottom=40)
# Keep last from looping to back button when down is pressed.
if i == len(pluglist) - 1:
ba.widget(edit=check, down_widget=check)
ba.containerwidget(edit=self._root_widget,
selected_child=self._scrollwidget)
ba.screenmessage('Work in progress...')
self._restore_state()
def _save_state(self) -> None:
print('would save state')
pass
def _restore_state(self) -> None:
print('would restore state')
pass
def _do_back(self) -> None:
# pylint: disable=cyclic-import

View File

@ -133,7 +133,6 @@ class TestingWindow(ba.Window):
self._on_minus_press, entry['name']))
if i == 0:
ba.widget(edit=btn, up_widget=self._back_button)
ba.widget(edit=btn, show_buffer_top=20, show_buffer_bottom=20)
entry['widget'] = ba.textwidget(parent=self._subcontainer,
position=(h + 100, v),
size=(0, 0),
@ -155,7 +154,7 @@ class TestingWindow(ba.Window):
ba.widget(edit=btn, up_widget=self._back_button)
v -= self._spacing
v -= 35
b_reset = ba.buttonwidget(
ba.buttonwidget(
parent=self._subcontainer,
autoselect=True,
size=(200, 50),
@ -163,7 +162,6 @@ class TestingWindow(ba.Window):
label=ba.Lstr(resource='settingsWindowAdvanced.resetText'),
right_widget=btn,
on_activate_call=self._on_reset_press)
ba.widget(edit=b_reset, show_buffer_top=20, show_buffer_bottom=20)
def _get_entry(self, name: str) -> Dict[str, Any]:
for entry in self._entries:

View File

@ -84,26 +84,24 @@ class TouchscreenSettingsWindow(ba.Window):
parent=self._root_widget,
position=((self._width - self._scroll_width) * 0.5,
self._height - 65 - self._scroll_height),
size=(self._scroll_width, self._scroll_height))
size=(self._scroll_width, self._scroll_height),
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
self._subcontainer = ba.containerwidget(parent=self._scrollwidget,
size=(self._sub_width,
self._sub_height),
background=False)
ba.containerwidget(edit=self._scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
ba.containerwidget(edit=self._subcontainer,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
background=False,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
self._build_gui()
def _build_gui(self) -> None:
from bastd.ui import config as cfgui
from bastd.ui import radiogroup
# clear anything already there
from bastd.ui.config import ConfigNumberEdit, ConfigCheckBox
from bastd.ui.radiogroup import make_radio_group
# Clear anything already there.
children = self._subcontainer.get_children()
for child in children:
child.delete()
@ -145,20 +143,19 @@ class TouchscreenSettingsWindow(ba.Window):
textcolor=clr2,
value=False,
scale=0.9)
radiogroup.make_radio_group((cb1, cb2), ('joystick', 'swipe'), cur_val,
self._movement_changed)
make_radio_group((cb1, cb2), ('joystick', 'swipe'), cur_val,
self._movement_changed)
v -= 50
cfgui.ConfigNumberEdit(
parent=self._subcontainer,
position=(h, v),
xoffset=65,
configkey='Touch Controls Scale Movement',
displayname=ba.Lstr(resource=self._r +
'.movementControlScaleText'),
changesound=False,
minval=0.1,
maxval=4.0,
increment=0.1)
ConfigNumberEdit(parent=self._subcontainer,
position=(h, v),
xoffset=65,
configkey='Touch Controls Scale Movement',
displayname=ba.Lstr(resource=self._r +
'.movementControlScaleText'),
changesound=False,
minval=0.1,
maxval=4.0,
increment=0.1)
v -= 50
cur_val = ba.app.config.get('Touch Action Control Type', 'buttons')
ba.textwidget(parent=self._subcontainer,
@ -183,28 +180,28 @@ class TouchscreenSettingsWindow(ba.Window):
maxwidth=100,
textcolor=clr2,
scale=0.9)
radiogroup.make_radio_group((cb1, cb2), ('buttons', 'swipe'), cur_val,
self._actions_changed)
make_radio_group((cb1, cb2), ('buttons', 'swipe'), cur_val,
self._actions_changed)
v -= 50
cfgui.ConfigNumberEdit(parent=self._subcontainer,
position=(h, v),
xoffset=65,
configkey='Touch Controls Scale Actions',
displayname=ba.Lstr(resource=self._r +
'.actionControlScaleText'),
changesound=False,
minval=0.1,
maxval=4.0,
increment=0.1)
ConfigNumberEdit(parent=self._subcontainer,
position=(h, v),
xoffset=65,
configkey='Touch Controls Scale Actions',
displayname=ba.Lstr(resource=self._r +
'.actionControlScaleText'),
changesound=False,
minval=0.1,
maxval=4.0,
increment=0.1)
v -= 50
cfgui.ConfigCheckBox(parent=self._subcontainer,
position=(h, v),
size=(400, 30),
maxwidth=400,
configkey='Touch Controls Swipe Hidden',
displayname=ba.Lstr(resource=self._r +
'.swipeControlsHiddenText'))
ConfigCheckBox(parent=self._subcontainer,
position=(h, v),
size=(400, 30),
maxwidth=400,
configkey='Touch Controls Swipe Hidden',
displayname=ba.Lstr(resource=self._r +
'.swipeControlsHiddenText'))
v -= 65
ba.buttonwidget(parent=self._subcontainer,

View File

@ -211,7 +211,7 @@ class SoundtrackBrowserWindow(ba.Window):
left_widget=self._new_button,
right_widget=_ba.get_special_widget('party_button')
if ba.app.ui.use_toolbars else self._scrollwidget)
self._col = ba.columnwidget(parent=scrollwidget)
self._col = ba.columnwidget(parent=scrollwidget, border=2, margin=0)
self._soundtracks: Optional[Dict[str, Any]] = None
self._selected_soundtrack: Optional[str] = None

View File

@ -155,18 +155,15 @@ class SoundtrackEditWindow(ba.Window):
highlight=False,
position=(40 + x_inset, v - (scroll_height + 10)),
size=(self._width - (80 + 2 * x_inset), scroll_height),
simple_culling_v=10)
simple_culling_v=10,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
ba.widget(edit=self._text_field, down_widget=self._scrollwidget)
self._col = ba.columnwidget(parent=scrollwidget)
ba.containerwidget(edit=self._scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
ba.containerwidget(edit=self._col,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
self._col = ba.columnwidget(parent=scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
self._song_type_buttons: Dict[str, ba.Widget] = {}
self._refresh()
@ -210,11 +207,11 @@ class SoundtrackEditWindow(ba.Window):
prev_test_button: Optional[ba.Widget] = None
for index, song_type in enumerate(types):
row = ba.rowwidget(parent=self._col, size=(self._width - 40, 40))
ba.containerwidget(edit=row,
row = ba.rowwidget(parent=self._col,
size=(self._width - 40, 40),
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
type_name = type_names_translated.get(song_type, song_type)
ba.textwidget(parent=row,
size=(230, 25),
@ -231,7 +228,7 @@ class SoundtrackEditWindow(ba.Window):
entry = None
if entry is not None:
# make sure they don't muck with this after it gets to us
# Make sure they don't muck with this after it gets to us.
entry = copy.deepcopy(entry)
icon_type = self._get_entry_button_display_icon_type(entry)

View File

@ -52,7 +52,8 @@ class MacMusicAppPlaylistSelectWindow(ba.Window):
position=(35, self._height - 65),
size=(130, 50),
label=ba.Lstr(resource='cancelText'),
on_activate_call=self._back)
on_activate_call=self._back,
autoselect=True)
ba.containerwidget(edit=self._root_widget, cancel_button=btn)
ba.textwidget(parent=self._root_widget,
position=(20, self._height - 54),
@ -64,19 +65,13 @@ class MacMusicAppPlaylistSelectWindow(ba.Window):
maxwidth=200)
self._scrollwidget = ba.scrollwidget(parent=self._root_widget,
position=(40, v - 340),
size=(self._width - 80, 400))
self._column = ba.columnwidget(parent=self._scrollwidget)
# So selection loops through everything and doesn't get stuck
# in sub-containers.
ba.containerwidget(edit=self._scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
ba.containerwidget(edit=self._column,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
size=(self._width - 80, 400),
claims_tab=True,
selection_loops_to_parent=True)
ba.widget(edit=self._scrollwidget, right_widget=self._scrollwidget)
self._column = ba.columnwidget(parent=self._scrollwidget,
claims_tab=True,
selection_loops_to_parent=True)
ba.textwidget(parent=self._column,
size=(self._width - 80, 22),
@ -93,7 +88,7 @@ class MacMusicAppPlaylistSelectWindow(ba.Window):
if self._column:
for widget in self._column.get_children():
widget.delete()
for playlist in playlists:
for i, playlist in enumerate(playlists):
txt = ba.textwidget(parent=self._column,
size=(self._width - 80, 30),
text=playlist,
@ -103,10 +98,13 @@ class MacMusicAppPlaylistSelectWindow(ba.Window):
on_activate_call=ba.Call(
self._sel, playlist),
click_activate=True)
ba.widget(edit=txt, show_buffer_top=40, show_buffer_bottom=40)
if playlist == self._existing_playlist:
ba.columnwidget(edit=self._column,
selected_child=txt,
visible_child=txt)
if i == len(playlists) - 1:
ba.widget(edit=txt, down_widget=txt)
def _sel(self, selection: str) -> None:
if self._root_widget:

View File

@ -353,19 +353,16 @@ class StoreBrowserWindow(ba.Window):
highlight=False,
position=((self._width - self._scroll_width) * 0.5,
self._height - self._scroll_height - 79 - 48),
size=(self._scroll_width, self._scroll_height))
size=(self._scroll_width, self._scroll_height),
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
# NOTE: this stuff is modified by the _Store class.
# Should maybe clean that up.
self.button_infos = {}
self.update_buttons_timer = None
# So we can still select root level widgets with controllers.
ba.containerwidget(edit=self._scrollwidget,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
# Show status over top.
if self._status_textwidget:
self._status_textwidget.delete()
@ -781,11 +778,10 @@ class StoreBrowserWindow(ba.Window):
cnt2 = ba.containerwidget(parent=scrollwidget,
scale=1.0,
size=(self._width, self._height),
background=False)
ba.containerwidget(edit=cnt2,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
background=False,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
v = self._height - 20
if self._tab == 'characters':
@ -976,11 +972,10 @@ class StoreBrowserWindow(ba.Window):
scale=1.0,
size=(self._scroll_width,
self._scroll_height * 0.95),
background=False)
ba.containerwidget(edit=cnt,
claims_left_right=True,
claims_tab=True,
selection_loop_to_parent=True)
background=False,
claims_left_right=True,
claims_tab=True,
selection_loops_to_parent=True)
self._status_textwidget = ba.textwidget(
parent=cnt,
position=(self._scroll_width * 0.5,

View File

@ -188,7 +188,7 @@ class WatchWindow(ba.Window):
(self._scroll_height - c_height) * 0.5),
size=(c_width, c_height),
background=False,
selection_loop_to_parent=True)
selection_loops_to_parent=True)
v = c_height - 30
ba.textwidget(parent=cnt,
@ -265,7 +265,10 @@ class WatchWindow(ba.Window):
position=(smlh, v),
size=(sub_scroll_width, sub_scroll_height))
ba.containerwidget(edit=cnt, selected_child=scrlw)
self._columnwidget = ba.columnwidget(parent=scrlw, left_border=10)
self._columnwidget = ba.columnwidget(parent=scrlw,
left_border=10,
border=2,
margin=0)
ba.widget(edit=scrlw,
autoselect=True,

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-07-19 for Ballistica version 1.5.23 build 20148</em></h4>
<h4><em>last updated on 2020-07-21 for Ballistica version 1.5.23 build 20149</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr>
@ -6071,7 +6071,12 @@ are applied to the Widget.</p>
print_list_exit_instructions: bool = None,
left_border: float = None,
top_border: float = None,
bottom_border: float = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
bottom_border: float = None,
selection_loops_to_parent: bool = None,
border: float = None,
margin: float = None,
claims_left_right: bool = None,
claims_tab: bool = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a column widget.</p>
@ -6097,7 +6102,7 @@ are applied to the Widget.</p>
claims_left_right: bool = None,
claims_tab: bool = None,
selection_loops: bool = None,
selection_loop_to_parent: bool = None,
selection_loops_to_parent: bool = None,
scale: float = None,
on_outside_click_call: Callable[[], None] = None,
single_depth: bool = None,
@ -6337,7 +6342,9 @@ in the background if necessary.</p>
on_select_call: Callable[[], None] = None,
center_small_content: bool = None, color: Sequence[float] = None,
highlight: bool = None, border_opacity: float = None,
simple_culling_h: float = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
simple_culling_h: float = None,
claims_left_right: bool = None,
claims_tab: bool = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a horizontal scroll widget.</p>
@ -6552,11 +6559,14 @@ app running.</p>
<hr>
<h2><strong><a name="function_ba_rowwidget">ba.rowwidget()</a></strong></h3>
<p><span>rowwidget(edit: Widget =None, parent: Widget =None,
<p><span>rowwidget(edit: Widget = None, parent: Widget = None,
size: Sequence[float] = None,
position: Sequence[float] = None,
background: bool = None, selected_child: Widget = None,
visible_child: Widget = None) -&gt; Widget</span></p>
visible_child: Widget = None,
claims_left_right: bool = None,
claims_tab: bool = None,
selection_loops_to_parent: bool = None) -&gt; Widget</span></p>
<p>Create or edit a row widget.</p>
@ -6607,7 +6617,10 @@ Currently the 'clients' option only works for transient messages.</p>
capture_arrows: bool = False, on_select_call: Callable = None,
center_small_content: bool = None, color: Sequence[float] = None,
highlight: bool = None, border_opacity: float = None,
simple_culling_v: float = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
simple_culling_v: float = None,
selection_loops_to_parent: bool = None,
claims_left_right: bool = None,
claims_tab: bool = None) -&gt; <a href="#class_ba_Widget">ba.Widget</a></span></p>
<p>Create or edit a scroll widget.</p>