Added ba.app.uiscale with a proper enum type

This commit is contained in:
Eric Froemling 2020-07-12 18:28:56 -07:00
parent 0db957a4c3
commit 09a3a300a2
83 changed files with 700 additions and 480 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/7c/92/8e0cbeffff273e5aa40fa584b602",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/41/4a/91a9073717d810d978101f035f75",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/13/cc/732f4cbdaa5ff318c7041b3cc46e",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/95/01/6e4e0ddd1b32d2a24267472811d9",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/63/ee/2230562fd122dbc68ace1959440a",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/18/0e/6aebdc438215b178618b209b3d38",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a6/6e/7041677d14ff3445e678e85ed509",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/78/7f/27a790f133b341a47e0d286631f6",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/3f/7b/6548e30606ba52f274a72f123473",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/df/d8/b1bfd4a2de519276ae8b3498e64d",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/56/77/a0fcc90f8be8ac87b677ac0c983d",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/45/1e/d1a5697069c1719b962140d4815b"
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/eb/bc/4dd3903ea7c71defdfc204c6f888",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/36/19/3c6dcb2ee2cfc7f089355e9c81a1",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/7b/33/ffe405cbec3b823592b8ebf06a59",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/e2/18/8d125a287dae90ab4623a423443f",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/2f/5d/f1fe725d479915bbe3d2e5f6b643",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a5/ae/f0e854f7cf68f8ffab4c3a94e403",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a7/0d/f8dbfe4faa05379b2330c9f91cab",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b9/c6/ac98c7aad5847fea5a37087d5aa0",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/4e/59/c8cbb6d6909ab853bfa61a5160ce",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/26/cd/737e2615e116d110aac319a3e293",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/45/28/ff409cd1913fc71bf9b677b87df0",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/a4/15/f823745542ea46f679552669b131"
}

View File

@ -963,6 +963,7 @@
<w>insta</w>
<w>installdir</w>
<w>instancer</w>
<w>interfacetype</w>
<w>interstitials</w>
<w>intex</w>
<w>intp</w>
@ -1779,6 +1780,7 @@
<w>sline</w>
<w>slval</w>
<w>smag</w>
<w>smallscale</w>
<w>smlh</w>
<w>smtpd</w>
<w>smtplib</w>

View File

@ -3,6 +3,9 @@
- Disconnecting an input-device now immediately removes the player instead of doing so in the next cycle; this prevents possible issues where code would try to access player.inputdevice before the removal happens which would lead to errors.
- Updated mac prefab builds to point at homebrew's python@3.7 package now that 3.8 has been made the default.
- Fixed an issue where adding/deleting UI widgets within certain callbacks could cause a crash.
- Fixed a case where an early fatal error could lead to a hung app and no error dialog.
- Added environment variables which can override UI scale for testing. Set BA_FORCE_UI_SCALE to small, medium or large.
- Added a ba.UIScale enum. The value at ba.app.uiscale replaces the old ba.app.interface_type, ba.app.small_ui, and ba.app.med_ui values.
### 1.5.19 (20123)
- Cleaned up some bomb logic to avoid weird corner-cases such as land-mine explosions behaving like punches when set off by punches or bombs potentially resulting in multiple explosions when triggered by multiple other bombs simultaneously. Holler if anything explosion-related seems off now.

View File

@ -46,7 +46,8 @@ from ba._coopgame import CoopGameActivity
from ba._coopsession import CoopSession
from ba._dependency import (Dependency, DependencyComponent, DependencySet,
AssetPackage)
from ba._enums import TimeType, Permission, TimeFormat, SpecialChar, InputType
from ba._enums import (TimeType, Permission, TimeFormat, SpecialChar,
InputType, UIScale)
from ba._error import (
print_exception, print_error, ContextError, NotFoundError,
PlayerNotFoundError, SessionPlayerNotFoundError, NodeNotFoundError,

View File

@ -26,7 +26,7 @@ from typing import TYPE_CHECKING
import _ba
from ba._activity import Activity
from ba._music import setmusic, MusicType
from ba._enums import InputType
from ba._enums import InputType, UIScale
# False-positive from pylint due to our class-generics-filter.
from ba._player import EmptyPlayer # pylint: disable=W0611
from ba._team import EmptyTeam # pylint: disable=W0611
@ -191,7 +191,7 @@ class ScoreScreenActivity(Activity[EmptyPlayer, EmptyTeam]):
# Pop up a 'press any button to continue' statement after our
# min-view-time show a 'press any button to continue..'
# thing after a bit.
if _ba.app.interface_type == 'large':
if _ba.app.uiscale is UIScale.LARGE:
# FIXME: Need a better way to determine whether we've probably
# got a keyboard.
sval = _lang.Lstr(resource='pressAnyKeyButtonText')

View File

@ -125,7 +125,7 @@ class App:
'hi': 'Hindi'
}
# Special case Chinese: specific variations map to traditional.
# Special case for Chinese: specific variations map to traditional.
# (otherwise will map to 'Chinese' which is simplified)
if self.locale in ('zh_HANT', 'zh_TW'):
language = 'ChineseTraditional'
@ -231,17 +231,9 @@ class App:
return CURRENT_API_VERSION
@property
def interface_type(self) -> str:
"""Interface mode the game is in; can be 'large', 'medium', or 'small'.
'large' is used by system such as desktop PC where elements on screen
remain usable even at small sizes, allowing more to be shown.
'small' is used by small devices such as phones, where elements on
screen must be larger to remain readable and usable.
'medium' is used by tablets and other middle-of-the-road situations
such as VR or TV.
"""
return self._interface_type
def uiscale(self) -> ba.UIScale:
"""Current ui scale for the app."""
return self._uiscale
@property
def on_tv(self) -> bool:
@ -269,6 +261,7 @@ class App:
"""
# pylint: disable=too-many-statements
from ba._music import MusicController
from ba._enums import UIScale
# Config.
self.config_file_healthy = False
@ -305,8 +298,16 @@ class App:
assert isinstance(self._platform, str)
self._subplatform: str = env['subplatform']
assert isinstance(self._subplatform, str)
self._interface_type: str = env['interface_type']
assert isinstance(self._interface_type, str)
self._uiscale: ba.UIScale
interfacetype = env['interface_type']
if interfacetype == 'large':
self._uiscale = UIScale.LARGE
elif interfacetype == 'medium':
self._uiscale = UIScale.MEDIUM
elif interfacetype == 'small':
self._uiscale = UIScale.SMALL
else:
raise RuntimeError('Invalid UIScale value: {interfacetype}')
self._on_tv: bool = env['on_tv']
assert isinstance(self._on_tv, bool)
self._vr_mode: bool = env['vr_mode']
@ -427,15 +428,10 @@ class App:
self.infotextcolor = (0.7, 0.9, 0.7)
self.uicleanupchecks: List[UICleanupCheck] = []
self.uiupkeeptimer: Optional[ba.Timer] = None
self.toolbars = env.get('toolbar_test', True)
self.delegate: Optional[ba.AppDelegate] = None
# A few shortcuts.
self.small_ui = env['interface_type'] == 'small'
self.med_ui = env['interface_type'] == 'medium'
self.large_ui = env['interface_type'] == 'large'
self.toolbars = env.get('toolbar_test', True)
def on_app_launch(self) -> None:
"""Runs after the app finishes bootstrapping.
@ -454,7 +450,7 @@ class App:
from bastd import appdelegate
from bastd import maps as stdmaps
from bastd.actor import spazappearance
from ba._enums import TimeType
from ba._enums import TimeType, UIScale
cfg = self.config
@ -482,12 +478,6 @@ class App:
and not _ba.is_blessed()):
_ba.screenmessage('WARNING: NON-BLESSED BUILD', color=(1, 0, 0))
# IMPORTANT - if tweaking UI stuff, you need to make sure it behaves
# for small, medium, and large UI modes. (doesn't run off screen, etc).
# Set these to 1 to test with different sizes. Generally small is used
# on phones, medium is used on tablets, and large is on desktops or
# large tablets.
# Kick off our periodic UI upkeep.
# FIXME: Can probably kill this if we do immediate UI death checks.
self.uiupkeeptimer = _ba.Timer(2.6543,
@ -495,29 +485,31 @@ class App:
timetype=TimeType.REAL,
repeat=True)
if bool(False): # force-test small UI
self.small_ui = True
self.med_ui = False
with _ba.Context('ui'):
_ba.pushcall(lambda: _ba.screenmessage(
'FORCING SMALL UI FOR TESTING', color=(1, 0, 1), log=True))
# IMPORTANT: If tweaking UI stuff, make sure it behaves for small,
# medium, and large UI modes. (doesn't run off screen, etc).
# The overrides below can be used to test with different sizes.
# Generally small is used on phones, medium is used on tablets/tvs,
# and large is on desktop computers or perhaps large tablets. When
# possible, run in windowed mode and resize the window to assure
# this holds true at all aspect ratios.
if bool(False): # force-test medium UI
self.small_ui = False
self.med_ui = True
with _ba.Context('ui'):
_ba.pushcall(lambda: _ba.screenmessage(
'FORCING MEDIUM UI FOR TESTING', color=(1, 0, 1
), log=True))
if bool(False): # force-test large UI
self.small_ui = False
self.med_ui = False
with _ba.Context('ui'):
_ba.pushcall(lambda: _ba.screenmessage(
'FORCING LARGE UI FOR TESTING', color=(1, 0, 1), log=True))
# UPDATE: A better way to test this is now by setting the environment
# variable BA_FORCE_UI_SCALE to "small", "medium", or "large".
# This will affect system UIs not covered by the values below such
# as screen-messages. The below values remain functional, however,
# for cases such as Android where environment variables can't be set
# easily.
# If there's a leftover log file, attempt to upload
# it to the server and/or get rid of it.
if bool(False): # force-test ui scale
self._uiscale = UIScale.SMALL
with _ba.Context('ui'):
_ba.pushcall(lambda: _ba.screenmessage(
f'FORCING UISCALE {self._uiscale.name} FOR TESTING',
color=(1, 0, 1),
log=True))
# If there's a leftover log file, attempt to upload it to the
# master-server and/or get rid of it.
_apputils.handle_leftover_log_file()
# Only do this stuff if our config file is healthy so we don't
@ -545,7 +537,7 @@ class App:
# Debugging - make note if we're using the local test server so we
# don't accidentally leave it on in a release.
# FIXME - move this to native layer.
# FIXME - should move this to the native layer.
server_addr = _ba.get_master_server_address()
if 'localhost' in server_addr:
_ba.timer(2.0,
@ -582,9 +574,7 @@ class App:
# Auto-sign-in to a local account in a moment if we're set to.
def do_auto_sign_in() -> None:
if self.headless_build:
_ba.sign_in('Local')
elif cfg.get('Auto Account State') == 'Local':
if self.headless_build or cfg.get('Auto Account State') == 'Local':
_ba.sign_in('Local')
_ba.pushcall(do_auto_sign_in)
@ -610,6 +600,7 @@ class App:
and not _ba.have_connected_clients()):
from ba import _gameutils, _lang
from ba._nodeactor import NodeActor
# FIXME: Shouldn't be touching scene stuff here;
# should just pass the request on to the host-session.
with _ba.Context(activity):

View File

@ -56,6 +56,31 @@ class InputType(Enum):
DOWN_RELEASE = 26
class UIScale(Enum):
"""The overall scale the UI is being rendered for. Note that this is
independent of pixel resolution. For example, a phone and a desktop PC
might render the game at similar pixel resolutions but the size they
display content at will vary significantly.
Category: Enums
'large' is used for devices such as desktop PCs where fine details can
be clearly seen. UI elements are generally smaller on the screen
and more content can be seen at once.
'medium' is used for devices such as tablets, TVs, or VR headsets.
This mode strikes a balance between clean readability and amount of
content visible.
'small' is used primarily for phones or other small devices where
content needs to be presented as large and clear in order to remain
readable from an average distance.
"""
LARGE = 0
MEDIUM = 1
SMALL = 2
class TimeType(Enum):
"""Specifies the type of time for various operations to target/use.

View File

@ -26,7 +26,7 @@ from dataclasses import dataclass
from typing import TYPE_CHECKING
import _ba
from ba._enums import TimeType, TimeFormat, SpecialChar
from ba._enums import TimeType, TimeFormat, SpecialChar, UIScale
from ba._error import ActivityNotFoundError
if TYPE_CHECKING:
@ -224,7 +224,7 @@ def show_damage_count(damage: str, position: Sequence[float],
# FIXME: Should never vary game elements based on local config.
# (connected clients may have differing configs so they won't
# get the intended results).
do_big = app.interface_type == 'small' or app.vr_mode
do_big = app.uiscale is UIScale.SMALL or app.vr_mode
txtnode = _ba.newnode('text',
attrs={
'text': damage,

View File

@ -54,7 +54,7 @@ class TeamSeriesVictoryScoreScreenActivity(MultiTeamScoreScreenActivity):
from ba.deprecated import get_resource
ba.set_analytics_screen('FreeForAll Series Victory Screen' if self.
_is_ffa else 'Teams Series Victory Screen')
if ba.app.interface_type == 'large':
if ba.app.uiscale is ba.UIScale.LARGE:
sval = ba.Lstr(resource='pressAnyKeyButtonPlayAgainText')
else:
sval = ba.Lstr(resource='pressAnyButtonPlayAgainText')

View File

@ -398,9 +398,9 @@ class RunaroundGame(ba.CoopGameActivity[Player, Team]):
self._tntspawner = TNTSpawner(position=self._tntspawnpos)
# Make sure to stay out of the way of menu/party buttons in the corner.
interface_type = ba.app.interface_type
l_offs = (-80 if interface_type == 'small' else
-40 if interface_type == 'medium' else 0)
uiscale = ba.app.uiscale
l_offs = (-80 if uiscale is ba.UIScale.SMALL else
-40 if uiscale is ba.UIScale.MEDIUM else 0)
self._lives_bg = ba.NodeActor(
ba.newnode('image',

View File

@ -65,7 +65,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
color = ((1.0, 1.0, 1.0, 1.0) if vr_mode else (0.5, 0.6, 0.5, 0.6))
# FIXME: Need a node attr for vr-specific-scale.
scale = (0.9 if
(app.interface_type == 'small' or vr_mode) else 0.7)
(app.uiscale is ba.UIScale.SMALL or vr_mode) else 0.7)
self.my_name = ba.NodeActor(
ba.newnode('text',
attrs={
@ -104,7 +104,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
# Any differences need to happen at the engine level so everyone sees
# things in their own optimal way.
vr_mode = app.vr_mode
interface_type = app.interface_type
uiscale = app.uiscale
# In cases where we're doing lots of dev work lets always show the
# build number.
@ -127,7 +127,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
])
else:
text = ba.Lstr(value='${V}', subs=[('${V}', app.version)])
scale = 0.9 if (interface_type == 'small' or vr_mode) else 0.7
scale = 0.9 if (uiscale is ba.UIScale.SMALL or vr_mode) else 0.7
color = (1, 1, 1, 1) if vr_mode else (0.5, 0.6, 0.5, 0.7)
self.version = ba.NodeActor(
ba.newnode(
@ -373,7 +373,7 @@ class MainMenuActivity(ba.Activity[ba.Player, ba.Team]):
ba.WeakCall(self._change_phrase),
repeat=True)
scl = 1.2 if (ba.app.interface_type == 'small'
scl = 1.2 if (ba.app.uiscale is ba.UIScale.SMALL
or ba.app.vr_mode) else 0.8
color2 = ((1, 1, 1, 1) if ba.app.vr_mode else

View File

@ -49,14 +49,15 @@ class AccountLinkWindow(ba.Window):
bg_color = (0.4, 0.4, 0.5)
self._width = 560
self._height = 420
base_scale = (1.65
if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.1)
uiscale = ba.app.uiscale
base_scale = (1.65 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.1)
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition=transition,
scale=base_scale,
scale_origin_stack_offset=scale_origin,
stack_offset=(0, -10) if ba.app.small_ui else (0, 0)))
stack_offset=(0, -10) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._cancel_button = ba.buttonwidget(parent=self._root_widget,
position=(40, self._height - 45),
size=(50, 50),
@ -131,11 +132,13 @@ class AccountLinkCodeWindow(ba.Window):
def __init__(self, data: Dict[str, Any]):
self._width = 350
self._height = 200
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
color=(0.45, 0.63, 0.15),
transition='in_scale',
scale=1.8 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0))
scale=(1.8 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0)))
self._data = copy.deepcopy(data)
ba.playsound(ba.getsound('cashRegister'))
ba.playsound(ba.getsound('swish'))

View File

@ -77,11 +77,12 @@ class AccountSettingsWindow(ba.Window):
self._can_reset_achievements = (account_type == 'Game Center')
app = ba.app
uiscale = app.uiscale
self._width = 760 if ba.app.small_ui else 660
x_offs = 50 if ba.app.small_ui else 0
self._height = (390
if ba.app.small_ui else 430 if ba.app.med_ui else 490)
self._width = 760 if uiscale is ba.UIScale.SMALL else 660
x_offs = 50 if uiscale is ba.UIScale.SMALL else 0
self._height = (390 if uiscale is ba.UIScale.SMALL else
430 if uiscale is ba.UIScale.MEDIUM else 490)
self._sign_in_button = None
self._sign_in_text = None
@ -103,15 +104,16 @@ class AccountSettingsWindow(ba.Window):
# exceptions.
self._show_sign_in_buttons.append('Local')
top_extra = 15 if ba.app.small_ui else 0
top_extra = 15 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
transition=transition,
toolbar_visibility='menu_minimal',
scale_origin_stack_offset=scale_origin,
scale=(2.09 if ba.app.small_ui else 1.4 if ba.app.med_ui else 1.0),
stack_offset=(0, -19) if ba.app.small_ui else (0, 0)))
if ba.app.small_ui and ba.app.toolbars:
scale=(2.09 if uiscale is ba.UIScale.SMALL else
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -19) if uiscale is ba.UIScale.SMALL else (0, 0)))
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
self._back_button = None
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._back)

View File

@ -50,14 +50,15 @@ class AccountUnlinkWindow(ba.Window):
self._height = 350
self._scroll_width = 400
self._scroll_height = 200
base_scale = (2.0
if ba.app.small_ui else 1.6 if ba.app.med_ui else 1.1)
uiscale = ba.app.uiscale
base_scale = (2.0 if uiscale is ba.UIScale.SMALL else
1.6 if uiscale is ba.UIScale.MEDIUM else 1.1)
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition=transition,
scale=base_scale,
scale_origin_stack_offset=scale_origin,
stack_offset=(0, -10) if ba.app.small_ui else (0, 0)))
stack_offset=(0, -10) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._cancel_button = ba.buttonwidget(parent=self._root_widget,
position=(30, self._height - 50),
size=(50, 50),

View File

@ -46,13 +46,15 @@ class AccountViewerWindow(popup.PopupWindow):
self._account_id = account_id
self._profile_id = profile_id
uiscale = ba.app.uiscale
if scale is None:
scale = (2.6 if ba.app.small_ui else 1.8 if ba.app.med_ui else 1.4)
scale = (2.6 if uiscale is ba.UIScale.SMALL else
1.8 if uiscale is ba.UIScale.MEDIUM else 1.4)
self._transitioning_out = False
self._width = 400
self._height = (300
if ba.app.small_ui else 400 if ba.app.med_ui else 450)
self._height = (300 if uiscale is ba.UIScale.SMALL else
400 if uiscale is ba.UIScale.MEDIUM else 450)
self._subcontainer: Optional[ba.Widget] = None
bg_color = (0.5, 0.4, 0.6)
@ -159,9 +161,11 @@ class AccountViewerWindow(popup.PopupWindow):
choices.append('ban')
choices_display.append(ba.Lstr(resource='banThisPlayerText'))
uiscale = ba.app.uiscale
popup.PopupMenuWindow(
position=self._extras_menu_button.get_screen_space_center(),
scale=2.3 if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23,
scale=(2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23),
choices=choices,
choices_display=choices_display,
current_choice='more',

View File

@ -36,13 +36,14 @@ class AchievementsWindow(popup.PopupWindow):
def __init__(self, position: Tuple[float, float], scale: float = None):
# pylint: disable=too-many-locals
uiscale = ba.app.uiscale
if scale is None:
scale = (2.3
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._transitioning_out = False
self._width = 450
self._height = (300
if ba.app.small_ui else 370 if ba.app.med_ui else 450)
self._height = (300 if uiscale is ba.UIScale.SMALL else
370 if uiscale is ba.UIScale.MEDIUM else 450)
bg_color = (0.5, 0.4, 0.6)
# creates our _root_widget

View File

@ -42,10 +42,12 @@ class AppInviteWindow(ba.Window):
self._width = 650
self._height = 400
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition='in_scale',
scale=1.8 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0))
scale=(1.8 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0)))
self._cancel_button = ba.buttonwidget(parent=self._root_widget,
scale=0.8,
@ -172,11 +174,13 @@ class ShowFriendCodeWindow(ba.Window):
ba.set_analytics_screen('Friend Promo Code')
self._width = 650
self._height = 400
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
color=(0.45, 0.63, 0.15),
transition='in_scale',
scale=1.7 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0))
scale=(1.7 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0)))
self._data = copy.deepcopy(data)
ba.playsound(ba.getsound('cashRegister'))
ba.playsound(ba.getsound('swish'))

View File

@ -48,9 +48,10 @@ class CharacterPicker(popup.PopupWindow):
# pylint: disable=too-many-locals
from bastd.actor import spazappearance
del parent # unused here
uiscale = ba.app.uiscale
if scale is None:
scale = (1.85
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
scale = (1.85 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._delegate = delegate
self._transitioning_out = False
@ -79,7 +80,8 @@ class CharacterPicker(popup.PopupWindow):
self._width = (10 + columns * (button_width + 2 * button_buffer_h) *
(1.0 / 0.95) * (1.0 / 0.8))
self._height = self._width * (0.8 if ba.app.small_ui else 1.06)
self._height = self._width * (0.8
if uiscale is ba.UIScale.SMALL else 1.06)
self._scroll_width = self._width * 0.8
self._scroll_height = self._height * 0.8

View File

@ -52,9 +52,10 @@ class ColorPicker(PopupWindow):
assert len(c_raw) == 16
self.colors = [c_raw[0:4], c_raw[4:8], c_raw[8:12], c_raw[12:16]]
uiscale = ba.app.uiscale
if scale is None:
scale = (2.3
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._parent = parent
self._position = position
self._scale = scale
@ -190,9 +191,10 @@ class ColorPickerExact(PopupWindow):
assert len(c_raw) == 16
self.colors = [c_raw[0:4], c_raw[4:8], c_raw[8:12], c_raw[12:16]]
uiscale = ba.app.uiscale
if scale is None:
scale = (2.3
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._delegate = delegate
self._transitioning_out = False
self._tag = tag

View File

@ -68,12 +68,14 @@ class ConfirmWindow:
scale_origin = None
transition = 'in_right'
uiscale = ba.app.uiscale
self.root_widget = ba.containerwidget(
size=(width, height),
transition=transition,
toolbar_visibility='menu_minimal_no_back',
parent=_ba.get_special_widget('overlay_stack'),
scale=2.1 if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0,
scale=(2.1 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0),
scale_origin_stack_offset=scale_origin)
ba.textwidget(parent=self.root_widget,

View File

@ -40,15 +40,17 @@ class CoopBrowserWindow(ba.Window):
"""Window for browsing co-op levels/games/etc."""
def _update_corner_button_positions(self) -> None:
offs = (-55 if ba.app.small_ui and _ba.is_party_icon_visible() else 0)
uiscale = ba.app.uiscale
offs = (-55 if uiscale is ba.UIScale.SMALL
and _ba.is_party_icon_visible() else 0)
if self._league_rank_button is not None:
self._league_rank_button.set_position(
(self._width - 282 + offs - self._x_inset,
self._height - 85 - (4 if ba.app.small_ui else 0)))
(self._width - 282 + offs - self._x_inset, self._height - 85 -
(4 if uiscale is ba.UIScale.SMALL else 0)))
if self._store_button is not None:
self._store_button.set_position(
(self._width - 170 + offs - self._x_inset,
self._height - 85 - (4 if ba.app.small_ui else 0)))
(self._width - 170 + offs - self._x_inset, self._height - 85 -
(4 if uiscale is ba.UIScale.SMALL else 0)))
def __init__(self,
transition: Optional[str] = 'in_right',
@ -96,12 +98,14 @@ class CoopBrowserWindow(ba.Window):
self._hard_button_lock_image: Optional[ba.Widget] = None
self._campaign_percent_text: Optional[ba.Widget] = None
self._width = 1320 if app.small_ui else 1120
self._x_inset = x_inset = 100 if app.small_ui else 0
self._height = (657 if app.small_ui else 730 if app.med_ui else 800)
uiscale = ba.app.uiscale
self._width = 1320 if uiscale is ba.UIScale.SMALL else 1120
self._x_inset = x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = (657 if uiscale is ba.UIScale.SMALL else
730 if uiscale is ba.UIScale.MEDIUM else 800)
app.main_window = 'Coop Select'
self._r = 'coopSelectWindow'
top_extra = 20 if app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
self._tourney_data_up_to_date = False
@ -112,18 +116,19 @@ class CoopBrowserWindow(ba.Window):
size=(self._width, self._height + top_extra),
toolbar_visibility='menu_full',
scale_origin_stack_offset=scale_origin,
stack_offset=((0, -15) if app.small_ui else (
0, 0) if app.med_ui else (0, 0)),
stack_offset=((0, -15) if uiscale is ba.UIScale.SMALL else (
0, 0) if uiscale is ba.UIScale.MEDIUM else (0, 0)),
transition=transition,
scale=1.2 if app.small_ui else 0.8 if app.med_ui else 0.75))
scale=(1.2 if uiscale is ba.UIScale.SMALL else
0.8 if uiscale is ba.UIScale.MEDIUM else 0.75)))
if app.toolbars and app.small_ui:
if app.toolbars and uiscale is ba.UIScale.SMALL:
self._back_button = None
else:
self._back_button = ba.buttonwidget(
parent=self._root_widget,
position=(75 + x_inset,
self._height - 87 - (4 if app.small_ui else 0)),
position=(75 + x_inset, self._height - 87 -
(4 if uiscale is ba.UIScale.SMALL else 0)),
size=(120, 60),
scale=1.2,
autoselect=True,
@ -138,8 +143,8 @@ class CoopBrowserWindow(ba.Window):
if not app.toolbars:
prb = self._league_rank_button = LeagueRankButton(
parent=self._root_widget,
position=(self._width - (282 + x_inset),
self._height - 85 - (4 if app.small_ui else 0)),
position=(self._width - (282 + x_inset), self._height - 85 -
(4 if uiscale is ba.UIScale.SMALL else 0)),
size=(100, 60),
color=(0.4, 0.4, 0.9),
textcolor=(0.9, 0.9, 2.0),
@ -149,8 +154,8 @@ class CoopBrowserWindow(ba.Window):
sbtn = self._store_button = StoreButton(
parent=self._root_widget,
position=(self._width - (170 + x_inset),
self._height - 85 - (4 if app.small_ui else 0)),
position=(self._width - (170 + x_inset), self._height - 85 -
(4 if uiscale is ba.UIScale.SMALL else 0)),
size=(100, 60),
color=(0.6, 0.4, 0.7),
show_tickets=True,
@ -195,7 +200,8 @@ class CoopBrowserWindow(ba.Window):
v = self._height - 95
txt = ba.textwidget(
parent=self._root_widget,
position=(self._width * 0.5, v + 40 - (0 if app.small_ui else 0)),
position=(self._width * 0.5,
v + 40 - (0 if uiscale is ba.UIScale.SMALL else 0)),
size=(0, 0),
text=ba.Lstr(resource='playModes.singlePlayerCoopText',
fallback_resource='playModes.coopText'),
@ -205,16 +211,17 @@ class CoopBrowserWindow(ba.Window):
maxwidth=500,
v_align='center')
if app.toolbars and app.small_ui:
if app.toolbars and uiscale is ba.UIScale.SMALL:
ba.textwidget(edit=txt, text='')
if self._back_button is not None:
ba.buttonwidget(edit=self._back_button,
button_type='backSmall',
size=(60, 50),
position=(75 + x_inset, self._height - 87 -
(4 if app.small_ui else 0) + 6),
label=ba.charstr(ba.SpecialChar.BACK))
ba.buttonwidget(
edit=self._back_button,
button_type='backSmall',
size=(60, 50),
position=(75 + x_inset, self._height - 87 -
(4 if uiscale is ba.UIScale.SMALL else 0) + 6),
label=ba.charstr(ba.SpecialChar.BACK))
self._selected_row = cfg.get('Selected Coop Row', None)
@ -225,8 +232,9 @@ class CoopBrowserWindow(ba.Window):
self.a_outline_model = ba.getmodel('achievementOutline')
self._scroll_width = self._width - (130 + 2 * x_inset)
self._scroll_height = self._height - (190 if app.small_ui
and app.toolbars else 160)
self._scroll_height = (
self._height -
(190 if uiscale is ba.UIScale.SMALL and app.toolbars else 160))
self._subcontainerwidth = 800.0
self._subcontainerheight = 1400.0
@ -234,7 +242,8 @@ class CoopBrowserWindow(ba.Window):
self._scrollwidget = ba.scrollwidget(
parent=self._root_widget,
highlight=False,
position=(65 + x_inset, 120) if app.small_ui and app.toolbars else
position=(65 + x_inset,
120) if uiscale is ba.UIScale.SMALL and app.toolbars else
(65 + x_inset, 70),
size=(self._scroll_width, self._scroll_height),
simple_culling_v=10.0)

View File

@ -32,10 +32,12 @@ class CoopLevelLockedWindow(ba.Window):
width = 550.0
height = 250.0
lock_tex = ba.gettexture('lock')
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition='in_right',
scale=1.7 if ba.app.small_ui else 1.3 if ba.app.med_ui else 1.0))
scale=(1.7 if uiscale is ba.UIScale.SMALL else
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0)))
ba.textwidget(parent=self._root_widget,
position=(150 - 20, height * 0.63),
size=(0, 0),

View File

@ -51,9 +51,10 @@ class CreditsListWindow(ba.Window):
scale_origin = None
transition = 'in_right'
width = 870 if ba.app.small_ui else 670
x_inset = 100 if ba.app.small_ui else 0
height = 398 if ba.app.small_ui else 500
uiscale = ba.app.uiscale
width = 870 if uiscale is ba.UIScale.SMALL else 670
x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
height = 398 if uiscale is ba.UIScale.SMALL else 500
self._r = 'creditsWindow'
super().__init__(root_widget=ba.containerwidget(
@ -61,33 +62,37 @@ class CreditsListWindow(ba.Window):
transition=transition,
toolbar_visibility='menu_minimal',
scale_origin_stack_offset=scale_origin,
scale=(2.0 if ba.app.small_ui else 1.3 if ba.app.med_ui else 1.0),
stack_offset=(0, -8) if ba.app.small_ui else (0, 0)))
scale=(2.0 if uiscale is ba.UIScale.SMALL else
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -8) if uiscale is ba.UIScale.SMALL else (0, 0)))
if ba.app.toolbars and ba.app.small_ui:
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._back)
else:
btn = ba.buttonwidget(parent=self._root_widget,
position=(40 + x_inset, height -
(68 if ba.app.small_ui else 62)),
size=(140, 60),
scale=0.8,
label=ba.Lstr(resource='backText'),
button_type='back',
on_activate_call=self._back,
autoselect=True)
btn = ba.buttonwidget(
parent=self._root_widget,
position=(40 + x_inset, height -
(68 if uiscale is ba.UIScale.SMALL else 62)),
size=(140, 60),
scale=0.8,
label=ba.Lstr(resource='backText'),
button_type='back',
on_activate_call=self._back,
autoselect=True)
ba.containerwidget(edit=self._root_widget, cancel_button=btn)
ba.buttonwidget(edit=btn,
button_type='backSmall',
position=(40 + x_inset, height -
(68 if ba.app.small_ui else 62) + 5),
size=(60, 48),
label=ba.charstr(ba.SpecialChar.BACK))
ba.buttonwidget(
edit=btn,
button_type='backSmall',
position=(40 + x_inset, height -
(68 if uiscale is ba.UIScale.SMALL else 62) + 5),
size=(60, 48),
label=ba.charstr(ba.SpecialChar.BACK))
ba.textwidget(parent=self._root_widget,
position=(0, height - (59 if ba.app.small_ui else 54)),
position=(0, height -
(59 if uiscale is ba.UIScale.SMALL else 54)),
size=(width, 30),
text=ba.Lstr(resource=self._r + '.titleText',
subs=[('${APP_NAME}',
@ -106,7 +111,7 @@ class CreditsListWindow(ba.Window):
if ba.app.toolbars:
ba.widget(edit=scroll,
right_widget=_ba.get_special_widget('party_button'))
if ba.app.small_ui:
if uiscale is ba.UIScale.SMALL:
ba.widget(edit=scroll,
left_widget=_ba.get_special_widget('back_button'))

View File

@ -38,9 +38,10 @@ class DebugWindow(ba.Window):
# pylint: disable=cyclic-import
from bastd.ui import popup
uiscale = ba.app.uiscale
self._width = width = 580
self._height = height = (350 if ba.app.small_ui else
420 if ba.app.med_ui else 520)
self._height = height = (350 if uiscale is ba.UIScale.SMALL else
420 if uiscale is ba.UIScale.MEDIUM else 520)
self._scroll_width = self._width - 100
self._scroll_height = self._height - 120
@ -54,12 +55,13 @@ class DebugWindow(ba.Window):
self._stress_test_round_duration = 30
self._r = 'debugWindow'
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition=transition,
scale=(
2.35 if ba.app.small_ui else 1.55 if ba.app.med_ui else 1.0),
stack_offset=(0, -30) if ba.app.small_ui else (0, 0)))
scale=(2.35 if uiscale is ba.UIScale.SMALL else
1.55 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -30) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._done_button = btn = ba.buttonwidget(
parent=self._root_widget,

View File

@ -41,10 +41,12 @@ def ask_for_rating() -> Optional[ba.Widget]:
width = 700
height = 400
spacing = 40
uiscale = ba.app.uiscale
dlg = ba.containerwidget(
size=(width, height),
transition='in_right',
scale=1.6 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0)
scale=(1.6 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0))
v = height - 50
v -= spacing
v -= 140

View File

@ -45,9 +45,10 @@ class FileSelectorWindow(ba.Window):
allow_folders: bool = False):
if valid_file_extensions is None:
valid_file_extensions = []
self._width = 700 if ba.app.small_ui else 600
self._x_inset = x_inset = 50 if ba.app.small_ui else 0
self._height = 365 if ba.app.small_ui else 418
uiscale = ba.app.uiscale
self._width = 700 if uiscale is ba.UIScale.SMALL else 600
self._x_inset = x_inset = 50 if uiscale is ba.UIScale.SMALL else 0
self._height = 365 if uiscale is ba.UIScale.SMALL else 418
self._callback = callback
self._base_path = path
self._path: Optional[str] = None
@ -65,8 +66,9 @@ class FileSelectorWindow(ba.Window):
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition='in_right',
scale=(2.23 if ba.app.small_ui else 1.4 if ba.app.med_ui else 1.0),
stack_offset=(0, -35) if ba.app.small_ui else (0, 0)))
scale=(2.23 if uiscale is ba.UIScale.SMALL else
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -35) if uiscale is ba.UIScale.SMALL else (0, 0)))
ba.textwidget(
parent=self._root_widget,
position=(self._width * 0.5, self._height - 42),

View File

@ -58,12 +58,13 @@ class GatherWindow(ba.Window):
ba.app.main_window = 'Gather'
_ba.set_party_icon_always_visible(True)
self._public_parties: Dict[str, Dict[str, Any]] = {}
self._width = 1240 if ba.app.small_ui else 1040
x_offs = 100 if ba.app.small_ui else 0
self._height = (582
if ba.app.small_ui else 680 if ba.app.med_ui else 800)
uiscale = ba.app.uiscale
self._width = 1240 if uiscale is ba.UIScale.SMALL else 1040
x_offs = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = (582 if uiscale is ba.UIScale.SMALL else
680 if uiscale is ba.UIScale.MEDIUM else 800)
self._current_tab: Optional[str] = None
extra_top = 20 if ba.app.small_ui else 0
extra_top = 20 if uiscale is ba.UIScale.SMALL else 0
self._r = 'gatherWindow'
self._tab_data: Any = None
self._internet_local_address: Optional[str] = None
@ -108,11 +109,12 @@ class GatherWindow(ba.Window):
transition=transition,
toolbar_visibility='menu_minimal',
scale_origin_stack_offset=scale_origin,
scale=(1.3 if ba.app.small_ui else 0.97 if ba.app.med_ui else 0.8),
stack_offset=(0, -11) if ba.app.small_ui else (
0, 0) if ba.app.med_ui else (0, 0)))
scale=(1.3 if uiscale is ba.UIScale.SMALL else
0.97 if uiscale is ba.UIScale.MEDIUM else 0.8),
stack_offset=(0, -11) if uiscale is ba.UIScale.SMALL else (
0, 0) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
if ba.app.small_ui and ba.app.toolbars:
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._back)
self._back_button = None
@ -173,7 +175,7 @@ class GatherWindow(ba.Window):
if ba.app.toolbars:
ba.widget(edit=self._tab_buttons[tabs_def[-1][0]],
right_widget=_ba.get_special_widget('party_button'))
if ba.app.small_ui:
if uiscale is ba.UIScale.SMALL:
ba.widget(edit=self._tab_buttons[tabs_def[0][0]],
left_widget=_ba.get_special_widget('back_button'))

View File

@ -65,23 +65,25 @@ class GetCurrencyWindow(ba.Window):
self._transition_out = 'out_right'
scale_origin = None
self._width = 1000.0 if ba.app.small_ui else 800.0
x_inset = 100.0 if ba.app.small_ui else 0.0
uiscale = ba.app.uiscale
self._width = 1000.0 if uiscale is ba.UIScale.SMALL else 800.0
x_inset = 100.0 if uiscale is ba.UIScale.SMALL else 0.0
self._height = 480.0
self._modal = modal
self._from_modal_store = from_modal_store
self._r = 'getTicketsWindow'
top_extra = 20 if ba.app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
transition=transition,
scale_origin_stack_offset=scale_origin,
color=(0.4, 0.37, 0.55),
scale=(1.63 if ba.app.small_ui else 1.2 if ba.app.med_ui else 1.0),
stack_offset=(0, -3) if ba.app.small_ui else (0, 0)))
scale=(1.63 if uiscale is ba.UIScale.SMALL else
1.2 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -3) if uiscale is ba.UIScale.SMALL else (0, 0)))
btn = ba.buttonwidget(
parent=self._root_widget,

View File

@ -36,7 +36,9 @@ class GetBSRemoteWindow(popup.PopupWindow):
def __init__(self) -> None:
position = (0.0, 0.0)
scale = (2.3 if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
uiscale = ba.app.uiscale
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._transitioning_out = False
self._width = 570
self._height = 350

View File

@ -57,22 +57,25 @@ class HelpWindow(ba.Window):
self._r = 'helpWindow'
self._main_menu = main_menu
width = 950 if ba.app.small_ui else 750
x_offs = 100 if ba.app.small_ui else 0
height = 460 if ba.app.small_ui else 530 if ba.app.med_ui else 600
uiscale = ba.app.uiscale
width = 950 if uiscale is ba.UIScale.SMALL else 750
x_offs = 100 if uiscale is ba.UIScale.SMALL else 0
height = (460 if uiscale is ba.UIScale.SMALL else
530 if uiscale is ba.UIScale.MEDIUM else 600)
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition=transition,
toolbar_visibility='menu_minimal',
scale_origin_stack_offset=scale_origin,
scale=(
1.77 if ba.app.small_ui else 1.25 if ba.app.med_ui else 1.0),
stack_offset=(0, -30) if ba.app.small_ui else (
0, 15) if ba.app.med_ui else (0, 0)))
scale=(1.77 if uiscale is ba.UIScale.SMALL else
1.25 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -30) if uiscale is ba.UIScale.SMALL else (
0, 15) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
ba.textwidget(parent=self._root_widget,
position=(0, height - (50 if ba.app.small_ui else 45)),
position=(0, height -
(50 if uiscale is ba.UIScale.SMALL else 45)),
size=(width, 25),
text=ba.Lstr(resource=self._r + '.titleText',
subs=[('${APP_NAME}',
@ -83,10 +86,10 @@ class HelpWindow(ba.Window):
self._scrollwidget = ba.scrollwidget(
parent=self._root_widget,
position=(44 + x_offs, 55 if ba.app.small_ui else 55),
position=(44 + x_offs, 55 if uiscale is ba.UIScale.SMALL else 55),
simple_culling_v=100.0,
size=(width - (88 + 2 * x_offs),
height - 120 + (5 if ba.app.small_ui else 0)),
height - 120 + (5 if uiscale is ba.UIScale.SMALL else 0)),
capture_arrows=True)
if ba.app.toolbars:
@ -97,7 +100,7 @@ class HelpWindow(ba.Window):
# ugly: create this last so it gets first dibs at touch events (since
# we have it close to the scroll widget)
if ba.app.small_ui and ba.app.toolbars:
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._close)
ba.widget(edit=self._scrollwidget,
@ -105,10 +108,12 @@ class HelpWindow(ba.Window):
else:
btn = ba.buttonwidget(
parent=self._root_widget,
position=(x_offs + (40 + 0 if ba.app.small_ui else 70),
height - (59 if ba.app.small_ui else 50)),
position=(x_offs +
(40 + 0 if uiscale is ba.UIScale.SMALL else 70),
height -
(59 if uiscale is ba.UIScale.SMALL else 50)),
size=(140, 60),
scale=0.7 if ba.app.small_ui else 0.8,
scale=0.7 if uiscale is ba.UIScale.SMALL else 0.8,
label=ba.Lstr(
resource='backText') if self._main_menu else 'Close',
button_type='back' if self._main_menu else None,
@ -123,8 +128,6 @@ class HelpWindow(ba.Window):
size=(60, 55),
label=ba.charstr(ba.SpecialChar.BACK))
# interface_type = ba.app.interface_type
self._sub_width = 660
self._sub_height = 1590 + get_resource(
self._r + '.someDaysExtraSpace') + get_resource(

View File

@ -50,9 +50,10 @@ class IconPicker(popup.PopupWindow):
del parent # unused here
del tint_color # unused_here
del tint2_color # unused here
uiscale = ba.app.uiscale
if scale is None:
scale = (1.85
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
scale = (1.85 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._delegate = delegate
self._transitioning_out = False
@ -69,7 +70,8 @@ class IconPicker(popup.PopupWindow):
self._width = (10 + columns * (button_width + 2 * button_buffer_h) *
(1.0 / 0.95) * (1.0 / 0.8))
self._height = self._width * (0.8 if ba.app.small_ui else 1.06)
self._height = (self._width *
(0.8 if uiscale is ba.UIScale.SMALL else 1.06))
self._scroll_width = self._width * 0.8
self._scroll_height = self._height * 0.8

View File

@ -311,6 +311,7 @@ class KioskWindow(ba.Window):
self._b4 = self._b5 = self._b6 = None
self._b7: Optional[ba.Widget]
uiscale = ba.app.uiscale
if bool(False):
self._b7 = ba.buttonwidget(
parent=self._root_widget,
@ -321,8 +322,8 @@ class KioskWindow(ba.Window):
scale=0.5,
position=((self._width * 0.5 - 37.5,
y_extra + 120) if not self._show_multiplayer else
(self._width + 100,
y_extra + (140 if ba.app.small_ui else 120))),
(self._width + 100, y_extra +
(140 if uiscale is ba.UIScale.SMALL else 120))),
transition_delay=tdelay,
label=ba.Lstr(resource=self._r + '.fullMenuText'),
on_activate_call=self._do_full_menu)

View File

@ -40,6 +40,7 @@ class LeagueRankWindow(ba.Window):
transition: str = 'in_right',
modal: bool = False,
origin_widget: ba.Widget = None):
# pylint: disable=too-many-statements
from ba.internal import get_cached_league_rank_data
from ba.deprecated import get_resource
ba.set_analytics_screen('League Rank Window')
@ -57,13 +58,14 @@ class LeagueRankWindow(ba.Window):
self._transition_out = 'out_right'
scale_origin = None
self._width = 1320 if ba.app.small_ui else 1120
x_inset = 100 if ba.app.small_ui else 0
self._height = (657
if ba.app.small_ui else 710 if ba.app.med_ui else 800)
uiscale = ba.app.uiscale
self._width = 1320 if uiscale is ba.UIScale.SMALL else 1120
x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = (657 if uiscale is ba.UIScale.SMALL else
710 if uiscale is ba.UIScale.MEDIUM else 800)
self._r = 'coopSelectWindow'
self._rdict = get_resource(self._r)
top_extra = 20 if ba.app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
self._league_url_arg = ''
@ -72,17 +74,17 @@ class LeagueRankWindow(ba.Window):
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
stack_offset=(0, -15) if ba.app.small_ui else (
0, 10) if ba.app.med_ui else (0, 0),
stack_offset=(0, -15) if uiscale is ba.UIScale.SMALL else (
0, 10) if uiscale is ba.UIScale.MEDIUM else (0, 0),
transition=transition,
scale_origin_stack_offset=scale_origin,
scale=(
1.2 if ba.app.small_ui else 0.93 if ba.app.med_ui else 0.8)))
scale=(1.2 if uiscale is ba.UIScale.SMALL else
0.93 if uiscale is ba.UIScale.MEDIUM else 0.8)))
self._back_button = btn = ba.buttonwidget(
parent=self._root_widget,
position=(75 + x_inset,
self._height - 87 - (4 if ba.app.small_ui else 0)),
position=(75 + x_inset, self._height - 87 -
(4 if uiscale is ba.UIScale.SMALL else 0)),
size=(120, 60),
scale=1.2,
autoselect=True,
@ -106,7 +108,7 @@ class LeagueRankWindow(ba.Window):
ba.buttonwidget(edit=btn,
button_type='backSmall',
position=(75 + x_inset, self._height - 87 -
(2 if ba.app.small_ui else 0)),
(2 if uiscale is ba.UIScale.SMALL else 0)),
size=(60, 55),
label=ba.charstr(ba.SpecialChar.BACK))

View File

@ -187,7 +187,7 @@ class MainMenuWindow(ba.Window):
self._r = 'mainMenu'
app = ba.app
self._have_quit_button = (app.interface_type == 'large'
self._have_quit_button = (app.uiscale is ba.UIScale.LARGE
or (app.platform == 'windows'
and app.subplatform == 'oculus'))
@ -288,8 +288,9 @@ class MainMenuWindow(ba.Window):
sale_scale=1.3,
transition_delay=self._tdelay)
self._store_button = store_button = sbtn.get_button()
icon_size = (55
if ba.app.small_ui else 55 if ba.app.med_ui else 70)
uiscale = ba.app.uiscale
icon_size = (55 if uiscale is ba.UIScale.SMALL else
55 if uiscale is ba.UIScale.MEDIUM else 70)
ba.imagewidget(
parent=self._root_widget,
position=(h - icon_size * 0.5,
@ -356,12 +357,13 @@ class MainMenuWindow(ba.Window):
b_size = 50.0
b_buffer = 10.0
t_scale = 0.75
if ba.app.small_ui:
uiscale = ba.app.uiscale
if uiscale is ba.UIScale.SMALL:
b_size *= 0.6
b_buffer *= 1.0
v_offs = -40
t_scale = 0.5
elif ba.app.med_ui:
elif uiscale is ba.UIScale.MEDIUM:
v_offs = -70
else:
v_offs = -100
@ -457,7 +459,8 @@ class MainMenuWindow(ba.Window):
b_count += 1
if self._have_store_button:
b_count += 1
if ba.app.small_ui:
uiscale = ba.app.uiscale
if uiscale is ba.UIScale.SMALL:
root_widget_scale = 1.6
play_button_width = self._button_width * 0.65
play_button_height = self._button_height * 1.1
@ -466,7 +469,7 @@ class MainMenuWindow(ba.Window):
button_y_offs2 = -60.0
self._button_height *= 1.3
button_spacing = 1.04
elif ba.app.med_ui:
elif uiscale is ba.UIScale.MEDIUM:
root_widget_scale = 1.3
play_button_width = self._button_width * 0.65
play_button_height = self._button_height * 1.1
@ -514,7 +517,9 @@ class MainMenuWindow(ba.Window):
on_activate_call=self._demo_menu_press)
else:
self._demo_menu_button = None
foof = (-1 if ba.app.small_ui else 1 if ba.app.med_ui else 3)
uiscale = ba.app.uiscale
foof = (-1 if uiscale is ba.UIScale.SMALL else
1 if uiscale is ba.UIScale.MEDIUM else 3)
h, v, scale = positions[self._p_index]
v = v + foof
gather_delay = 0.0 if self._t_delay_play == 0.0 else max(
@ -710,10 +715,12 @@ class MainMenuWindow(ba.Window):
# In this case we have a leave *and* a disconnect button.
self._height += 50
self._height += 50 * (len(custom_menu_entries))
uiscale = ba.app.uiscale
ba.containerwidget(
edit=self._root_widget,
size=(self._width, self._height),
scale=2.15 if ba.app.small_ui else 1.6 if ba.app.med_ui else 1.0)
scale=(2.15 if uiscale is ba.UIScale.SMALL else
1.6 if uiscale is ba.UIScale.MEDIUM else 1.0))
h = 125.0
v = (self._height - 80.0 if self._input_player else self._height - 60)
h_offset = 0

View File

@ -39,16 +39,18 @@ class OnScreenKeyboardWindow(ba.Window):
self._target_text = textwidget
self._width = 700
self._height = 400
top_extra = 20 if ba.app.small_ui else 0
uiscale = ba.app.uiscale
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
parent=_ba.get_special_widget('overlay_stack'),
size=(self._width, self._height + top_extra),
transition='in_scale',
scale_origin_stack_offset=self._target_text.
get_screen_space_center(),
scale=(2.0 if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0),
stack_offset=(0, 0) if ba.app.small_ui else (
0, 0) if ba.app.med_ui else (0, 0)))
scale=(2.0 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, 0) if uiscale is ba.UIScale.SMALL else (
0, 0) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
self._done_button = ba.buttonwidget(parent=self._root_widget,
position=(self._width - 200, 44),
size=(140, 60),

View File

@ -47,8 +47,9 @@ class PartyWindow(ba.Window):
self._popup_party_member_client_id: Optional[int] = None
self._popup_party_member_is_host: Optional[bool] = None
self._width = 500
self._height = (365
if ba.app.small_ui else 480 if ba.app.med_ui else 600)
uiscale = ba.app.uiscale
self._height = (365 if uiscale is ba.UIScale.SMALL else
480 if uiscale is ba.UIScale.MEDIUM else 600)
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition='in_scale',
@ -56,9 +57,10 @@ class PartyWindow(ba.Window):
parent=_ba.get_special_widget('overlay_stack'),
on_outside_click_call=self.close_with_sound,
scale_origin_stack_offset=origin,
scale=(2.0 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0),
stack_offset=(0, -10) if ba.app.small_ui else (
240, 0) if ba.app.med_ui else (330, 20)))
scale=(2.0 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -10) if uiscale is ba.UIScale.SMALL else (
240, 0) if uiscale is ba.UIScale.MEDIUM else (330, 20)))
self._cancel_button = ba.buttonwidget(parent=self._root_widget,
scale=0.7,
@ -198,9 +200,11 @@ class PartyWindow(ba.Window):
def _on_menu_button_press(self) -> None:
is_muted = ba.app.config.resolve('Chat Muted')
uiscale = ba.app.uiscale
popup.PopupMenuWindow(
position=self._menu_button.get_screen_space_center(),
scale=2.3 if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23,
scale=(2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23),
choices=['unmute' if is_muted else 'mute'],
choices_display=[
ba.Lstr(
@ -400,9 +404,11 @@ class PartyWindow(ba.Window):
14248):
return
kick_str = ba.Lstr(resource='kickVoteText')
uiscale = ba.app.uiscale
popup.PopupMenuWindow(
position=widget.get_screen_space_center(),
scale=2.3 if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23,
scale=(2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23),
choices=['kick'],
choices_display=[kick_str],
current_choice='kick',

View File

@ -223,11 +223,13 @@ class PartyQueueWindow(ba.Window):
self._line_image: Optional[ba.Widget] = None
self.eyes_model = ba.getmodel('plasticEyesTransparent')
self._white_tex = ba.gettexture('white')
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
color=(0.45, 0.63, 0.15),
transition='in_scale',
scale=1.4 if ba.app.small_ui else 1.2 if ba.app.med_ui else 1.0))
scale=(1.4 if uiscale is ba.UIScale.SMALL else
1.2 if uiscale is ba.UIScale.MEDIUM else 1.0)))
self._cancel_button = ba.buttonwidget(parent=self._root_widget,
scale=1.0,

View File

@ -46,8 +46,9 @@ class PlayWindow(ba.Window):
threading.Thread(target=self._preload_modules).start()
new_style = True
width = 1000 if ba.app.small_ui else 800
x_offs = 100 if ba.app.small_ui else 0
uiscale = ba.app.uiscale
width = 1000 if uiscale is ba.UIScale.SMALL else 800
x_offs = 100 if uiscale is ba.UIScale.SMALL else 0
height = 550 if new_style else 400
button_width = 400
@ -67,10 +68,10 @@ class PlayWindow(ba.Window):
transition=transition,
toolbar_visibility='menu_full',
scale_origin_stack_offset=scale_origin,
scale=(1.6 if new_style else 1.52
) if ba.app.small_ui else 0.9 if ba.app.med_ui else 0.8,
scale=((1.6 if new_style else 1.52) if uiscale is ba.UIScale.SMALL
else 0.9 if uiscale is ba.UIScale.MEDIUM else 0.8),
stack_offset=((0, 0) if new_style else (
10, 7)) if ba.app.small_ui else (0, 0)))
10, 7)) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._back_button = back_button = btn = ba.buttonwidget(
parent=self._root_widget,
position=(55 + x_offs, height - 132) if new_style else
@ -99,14 +100,14 @@ class PlayWindow(ba.Window):
button_type='backSmall',
size=(60, 60),
label=ba.charstr(ba.SpecialChar.BACK))
if ba.app.toolbars and ba.app.small_ui:
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
ba.textwidget(edit=txt, text='')
v = height - (110 if new_style else 60)
v -= 100
clr = (0.6, 0.7, 0.6, 1.0)
v -= 280 if new_style else 180
v += 30 if ba.app.toolbars and ba.app.small_ui else 0
v += 30 if ba.app.toolbars and uiscale is ba.UIScale.SMALL else 0
hoffs = x_offs + 80 if new_style else 0
scl = 1.13 if new_style else 0.68
@ -134,7 +135,7 @@ class PlayWindow(ba.Window):
text_scale=1.13,
on_activate_call=self._coop)
if ba.app.toolbars and ba.app.small_ui:
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
ba.widget(edit=btn,
left_widget=_ba.get_special_widget('back_button'))
ba.widget(edit=btn,
@ -403,7 +404,7 @@ class PlayWindow(ba.Window):
maxwidth=scl * button_width * 0.7,
color=clr)
if ba.app.toolbars and ba.app.small_ui:
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
back_button.delete()
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._back,

View File

@ -40,18 +40,20 @@ class PlaylistAddGameWindow(ba.Window):
transition: str = 'in_right'):
self._editcontroller = editcontroller
self._r = 'addGameWindow'
self._width = 750 if ba.app.small_ui else 650
x_inset = 50 if ba.app.small_ui else 0
self._height = (346
if ba.app.small_ui else 380 if ba.app.med_ui else 440)
top_extra = 30 if ba.app.small_ui else 20
uiscale = ba.app.uiscale
self._width = 750 if uiscale is ba.UIScale.SMALL else 650
x_inset = 50 if uiscale is ba.UIScale.SMALL else 0
self._height = (346 if uiscale is ba.UIScale.SMALL else
380 if uiscale is ba.UIScale.MEDIUM else 440)
top_extra = 30 if uiscale is ba.UIScale.SMALL else 20
self._scroll_width = 210
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
transition=transition,
scale=(2.17 if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0),
stack_offset=(0, 1) if ba.app.small_ui else (0, 0)))
scale=(2.17 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, 1) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._back_button = ba.buttonwidget(parent=self._root_widget,
position=(58 + x_inset,

View File

@ -218,21 +218,22 @@ class PlaylistBrowserWindow(ba.Window):
self._selected_playlist = ba.app.config.get(self._pvars.config_name +
' Playlist Selection')
self._width = 900 if ba.app.small_ui else 800
x_inset = 50 if ba.app.small_ui else 0
self._height = (480
if ba.app.small_ui else 510 if ba.app.med_ui else 580)
uiscale = ba.app.uiscale
self._width = 900 if uiscale is ba.UIScale.SMALL else 800
x_inset = 50 if uiscale is ba.UIScale.SMALL else 0
self._height = (480 if uiscale is ba.UIScale.SMALL else
510 if uiscale is ba.UIScale.MEDIUM else 580)
top_extra = 20 if ba.app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
transition=transition,
toolbar_visibility='menu_full',
scale_origin_stack_offset=scale_origin,
scale=(
1.69 if ba.app.small_ui else 1.05 if ba.app.med_ui else 0.9),
stack_offset=(0, -26) if ba.app.small_ui else (0, 0)))
scale=(1.69 if uiscale is ba.UIScale.SMALL else
1.05 if uiscale is ba.UIScale.MEDIUM else 0.9),
stack_offset=(0, -26) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._back_button: Optional[ba.Widget] = ba.buttonwidget(
parent=self._root_widget,
@ -255,7 +256,7 @@ class PlaylistBrowserWindow(ba.Window):
color=ba.app.heading_color,
h_align='center',
v_align='center')
if ba.app.small_ui and ba.app.toolbars:
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
ba.textwidget(edit=txt, text='')
ba.buttonwidget(edit=self._back_button,
@ -264,7 +265,7 @@ class PlaylistBrowserWindow(ba.Window):
position=(59 + x_inset, self._height - 67),
label=ba.charstr(ba.SpecialChar.BACK))
if ba.app.small_ui and ba.app.toolbars:
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
self._back_button.delete()
self._back_button = None
ba.containerwidget(edit=self._root_widget,
@ -273,8 +274,8 @@ class PlaylistBrowserWindow(ba.Window):
else:
scroll_offs = 0
self._scroll_width = self._width - (100 + 2 * x_inset)
self._scroll_height = self._height - (146 if ba.app.small_ui
and ba.app.toolbars else 136)
self._scroll_height = self._height - (
146 if uiscale is ba.UIScale.SMALL and ba.app.toolbars else 136)
self._scrollwidget = ba.scrollwidget(
parent=self._root_widget,
highlight=False,
@ -364,6 +365,7 @@ class PlaylistBrowserWindow(ba.Window):
h_offs = 225 if count == 1 else 115 if count == 2 else 0
h_offs_bottom = 0
uiscale = ba.app.uiscale
for y in range(rows):
for x in range(columns):
name = items[index][0]
@ -378,11 +380,12 @@ class PlaylistBrowserWindow(ba.Window):
label='',
position=pos)
if x == 0 and ba.app.toolbars and ba.app.small_ui:
if x == 0 and ba.app.toolbars and uiscale is ba.UIScale.SMALL:
ba.widget(
edit=btn,
left_widget=_ba.get_special_widget('back_button'))
if x == columns - 1 and ba.app.toolbars and ba.app.small_ui:
if (x == columns - 1 and ba.app.toolbars
and uiscale is ba.UIScale.SMALL):
ba.widget(
edit=btn,
right_widget=_ba.get_special_widget('party_button'))

View File

@ -59,18 +59,20 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
self._pvars = playlist.PlaylistTypeVars(sessiontype)
self._max_playlists = 30
self._r = 'gameListWindow'
self._width = 750.0 if ba.app.small_ui else 650.0
x_inset = 50.0 if ba.app.small_ui else 0.0
self._height = (380.0 if ba.app.small_ui else
420.0 if ba.app.med_ui else 500.0)
top_extra = 20.0 if ba.app.small_ui else 0.0
uiscale = ba.app.uiscale
self._width = 750.0 if uiscale is ba.UIScale.SMALL else 650.0
x_inset = 50.0 if uiscale is ba.UIScale.SMALL else 0.0
self._height = (380.0 if uiscale is ba.UIScale.SMALL else
420.0 if uiscale is ba.UIScale.MEDIUM else 500.0)
top_extra = 20.0 if uiscale is ba.UIScale.SMALL else 0.0
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
transition=transition,
scale_origin_stack_offset=scale_origin,
scale=(2.05 if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0),
stack_offset=(0, -10) if ba.app.small_ui else (0, 0)))
scale=(2.05 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -10) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._back_button = back_button = btn = ba.buttonwidget(
parent=self._root_widget,
@ -105,7 +107,8 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
self._lock_images: List[ba.Widget] = []
lock_tex = ba.gettexture('lock')
scl = (1.1 if ba.app.small_ui else 1.27 if ba.app.med_ui else 1.57)
scl = (1.1 if uiscale is ba.UIScale.SMALL else
1.27 if uiscale is ba.UIScale.MEDIUM else 1.57)
scl *= 0.63
v -= 65.0 * scl
new_button = btn = ba.buttonwidget(

View File

@ -45,17 +45,19 @@ class PlaylistEditWindow(ba.Window):
self._r = 'editGameListWindow'
prev_selection = self._editcontroller.get_edit_ui_selection()
self._width = 770 if ba.app.small_ui else 670
x_inset = 50 if ba.app.small_ui else 0
self._height = (400
if ba.app.small_ui else 470 if ba.app.med_ui else 540)
uiscale = ba.app.uiscale
self._width = 770 if uiscale is ba.UIScale.SMALL else 670
x_inset = 50 if uiscale is ba.UIScale.SMALL else 0
self._height = (400 if uiscale is ba.UIScale.SMALL else
470 if uiscale is ba.UIScale.MEDIUM else 540)
top_extra = 20 if ba.app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
transition=transition,
scale=(2.0 if ba.app.small_ui else 1.3 if ba.app.med_ui else 1.0),
stack_offset=(0, -16) if ba.app.small_ui else (0, 0)))
scale=(2.0 if uiscale is ba.UIScale.SMALL else
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -16) if uiscale is ba.UIScale.SMALL else (0, 0)))
cancel_button = ba.buttonwidget(parent=self._root_widget,
position=(35 + x_inset,
self._height - 60),
@ -133,7 +135,8 @@ class PlaylistEditWindow(ba.Window):
v -= 2.0
v += 63
scl = (1.03 if ba.app.small_ui else 1.36 if ba.app.med_ui else 1.74)
scl = (1.03 if uiscale is ba.UIScale.SMALL else
1.36 if uiscale is ba.UIScale.MEDIUM else 1.74)
v -= 63.0 * scl
add_game_button = ba.buttonwidget(

View File

@ -106,9 +106,11 @@ class PlaylistEditGameWindow(ba.Window):
self._choice_selections: Dict[str, int] = {}
width = 720 if ba.app.small_ui else 620
x_inset = 50 if ba.app.small_ui else 0
height = (365 if ba.app.small_ui else 460 if ba.app.med_ui else 550)
uiscale = ba.app.uiscale
width = 720 if uiscale is ba.UIScale.SMALL else 620
x_inset = 50 if uiscale is ba.UIScale.SMALL else 0
height = (365 if uiscale is ba.UIScale.SMALL else
460 if uiscale is ba.UIScale.MEDIUM else 550)
spacing = 52
y_extra = 15
y_extra2 = 21
@ -118,13 +120,13 @@ class PlaylistEditGameWindow(ba.Window):
raise Exception('no map preview tex found for' + self._map)
map_tex = ba.gettexture(map_tex_name)
top_extra = 20 if ba.app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(width, height + top_extra),
transition=transition,
scale=(
2.19 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0),
stack_offset=(0, -17) if ba.app.small_ui else (0, 0)))
scale=(2.19 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -17) if uiscale is ba.UIScale.SMALL else (0, 0)))
btn = ba.buttonwidget(
parent=self._root_widget,

View File

@ -55,16 +55,19 @@ class PlaylistMapSelectWindow(ba.Window):
except Exception:
self._previous_map = ''
width = 715 if ba.app.small_ui else 615
x_inset = 50 if ba.app.small_ui else 0
height = (400 if ba.app.small_ui else 480 if ba.app.med_ui else 600)
uiscale = ba.app.uiscale
width = 715 if uiscale is ba.UIScale.SMALL else 615
x_inset = 50 if uiscale is ba.UIScale.SMALL else 0
height = (400 if uiscale is ba.UIScale.SMALL else
480 if uiscale is ba.UIScale.MEDIUM else 600)
top_extra = 20 if ba.app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(width, height + top_extra),
transition=transition,
scale=(2.17 if ba.app.small_ui else 1.3 if ba.app.med_ui else 1.0),
stack_offset=(0, -27) if ba.app.small_ui else (0, 0)))
scale=(2.17 if uiscale is ba.UIScale.SMALL else
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -27) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._cancel_button = btn = ba.buttonwidget(
parent=self._root_widget,

View File

@ -89,11 +89,13 @@ class SharePlaylistResultsWindow(ba.Window):
del origin # unused arg
self._width = 450
self._height = 300
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
color=(0.45, 0.63, 0.15),
transition='in_scale',
scale=1.8 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0))
scale=(1.8 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0)))
ba.playsound(ba.getsound('cashRegister'))
ba.playsound(ba.getsound('swish'))

View File

@ -149,7 +149,9 @@ class PlayOptionsWindow(popup.PopupWindow):
self._height += 40
# Creates our _root_widget.
scale = (1.69 if ba.app.small_ui else 1.1 if ba.app.med_ui else 0.85)
uiscale = ba.app.uiscale
scale = (1.69 if uiscale is ba.UIScale.SMALL else
1.1 if uiscale is ba.UIScale.MEDIUM else 0.85)
super().__init__(position=scale_origin,
size=(self._width, self._height),
scale=scale)

View File

@ -291,13 +291,15 @@ class PopupMenu:
choices_display: Sequence[ba.Lstr] = None,
button_size: Tuple[float, float] = (160.0, 50.0),
autoselect: bool = True):
# pylint: disable=too-many-locals
if choices_disabled is None:
choices_disabled = []
if choices_display is None:
choices_display = []
uiscale = ba.app.uiscale
if scale is None:
scale = (2.3
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
if current_choice not in choices:
current_choice = None
self._choices = list(choices)

View File

@ -47,10 +47,11 @@ class ProfileBrowserWindow(ba.Window):
back_label = ba.Lstr(resource='backText')
else:
back_label = ba.Lstr(resource='doneText')
self._width = 700.0 if ba.app.small_ui else 600.0
x_inset = 50.0 if ba.app.small_ui else 0.0
self._height = (360.0 if ba.app.small_ui else
385.0 if ba.app.med_ui else 410.0)
uiscale = ba.app.uiscale
self._width = 700.0 if uiscale is ba.UIScale.SMALL else 600.0
x_inset = 50.0 if uiscale is ba.UIScale.SMALL else 0.0
self._height = (360.0 if uiscale is ba.UIScale.SMALL else
385.0 if uiscale is ba.UIScale.MEDIUM else 410.0)
# If we're being called up standalone, handle pause/resume ourself.
if not self._in_main_menu:
@ -71,14 +72,15 @@ class ProfileBrowserWindow(ba.Window):
# Ensure we've got an account-profile in cases where we're signed in.
ensure_have_account_player_profile()
top_extra = 20 if ba.app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
transition=transition,
scale_origin_stack_offset=scale_origin,
scale=(2.2 if ba.app.small_ui else 1.6 if ba.app.med_ui else 1.0),
stack_offset=(0, -14) if ba.app.small_ui else (0, 0)))
scale=(2.2 if uiscale is ba.UIScale.SMALL else
1.6 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -14) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._back_button = btn = ba.buttonwidget(
parent=self._root_widget,
@ -113,7 +115,8 @@ class ProfileBrowserWindow(ba.Window):
h = 50 + x_inset
b_color = (0.6, 0.53, 0.63)
scl = (1.055 if ba.app.small_ui else 1.18 if ba.app.med_ui else 1.3)
scl = (1.055 if uiscale is ba.UIScale.SMALL else
1.18 if uiscale is ba.UIScale.MEDIUM else 1.3)
v -= 70.0 * scl
self._new_button = ba.buttonwidget(parent=self._root_widget,
position=(h, v),

View File

@ -62,19 +62,21 @@ class EditProfileWindow(ba.Window):
# Grab profile colors or pick random ones.
self._color, self._highlight = get_player_profile_colors(
existing_profile)
self._width = width = 780.0 if ba.app.small_ui else 680.0
self._x_inset = x_inset = 50.0 if ba.app.small_ui else 0.0
self._height = height = (350.0 if ba.app.small_ui else
400.0 if ba.app.med_ui else 450.0)
uiscale = ba.app.uiscale
self._width = width = 780.0 if uiscale is ba.UIScale.SMALL else 680.0
self._x_inset = x_inset = 50.0 if uiscale is ba.UIScale.SMALL else 0.0
self._height = height = (
350.0 if uiscale is ba.UIScale.SMALL else
400.0 if uiscale is ba.UIScale.MEDIUM else 450.0)
spacing = 40
self._base_scale = (2.05 if ba.app.small_ui else
1.5 if ba.app.med_ui else 1.0)
top_extra = 15 if ba.app.small_ui else 15
self._base_scale = (2.05 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0)
top_extra = 15 if uiscale is ba.UIScale.SMALL else 15
super().__init__(root_widget=ba.containerwidget(
size=(width, height + top_extra),
transition=transition,
scale=self._base_scale,
stack_offset=(0, 15) if ba.app.small_ui else (0, 0)))
stack_offset=(0, 15) if uiscale is ba.UIScale.SMALL else (0, 0)))
cancel_button = btn = ba.buttonwidget(
parent=self._root_widget,
position=(52 + x_inset, height - 60),

View File

@ -45,19 +45,20 @@ class ProfileUpgradeWindow(ba.Window):
self._width = 680
self._height = 350
self._base_scale = (2.05 if ba.app.small_ui else
1.5 if ba.app.med_ui else 1.2)
uiscale = ba.app.uiscale
self._base_scale = (2.05 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.2)
self._upgrade_start_time: Optional[float] = None
self._name = edit_profile_window.getname()
self._edit_profile_window = weakref.ref(edit_profile_window)
top_extra = 15 if ba.app.small_ui else 15
top_extra = 15 if uiscale is ba.UIScale.SMALL else 15
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
toolbar_visibility='menu_currency',
transition=transition,
scale=self._base_scale,
stack_offset=(0, 15) if ba.app.small_ui else (0, 0)))
stack_offset=(0, 15) if uiscale is ba.UIScale.SMALL else (0, 0)))
cancel_button = ba.buttonwidget(parent=self._root_widget,
position=(52, 30),
size=(155, 60),

View File

@ -53,12 +53,14 @@ class PromoCodeWindow(ba.Window):
self._modal = modal
self._r = 'promoCodeWindow'
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition=transition,
toolbar_visibility='menu_minimal_no_back',
scale_origin_stack_offset=scale_origin,
scale=(2.0 if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0)))
scale=(2.0 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0)))
btn = ba.buttonwidget(parent=self._root_widget,
scale=0.5,

View File

@ -48,12 +48,14 @@ class PurchaseWindow(ba.Window):
self._items = list(items)
self._width = 580
self._height = 520
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition=transition,
toolbar_visibility='menu_currency',
scale=(1.2 if ba.app.small_ui else 1.1 if ba.app.med_ui else 1.0),
stack_offset=(0, -15) if ba.app.small_ui else (0, 0)))
scale=(1.2 if uiscale is ba.UIScale.SMALL else
1.1 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -15) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._is_double = False
self._title_text = ba.textwidget(parent=self._root_widget,
position=(self._width * 0.5,

View File

@ -31,7 +31,9 @@ class QRCodeWindow(popup.PopupWindow):
def __init__(self, origin_widget: ba.Widget, qr_tex: ba.Texture):
position = origin_widget.get_screen_space_center()
scale = (2.3 if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
uiscale = ba.app.uiscale
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._transitioning_out = False
self._width = 450
self._height = 400

View File

@ -37,13 +37,14 @@ class ReportPlayerWindow(ba.Window):
scale_origin = origin_widget.get_screen_space_center()
overlay_stack = _ba.get_special_widget('overlay_stack')
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
parent=overlay_stack,
transition='in_scale',
scale_origin_stack_offset=scale_origin,
scale=(
1.8 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0)))
scale=(1.8 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0)))
self._cancel_button = ba.buttonwidget(parent=self._root_widget,
scale=0.7,
position=(40, self._height - 50),

View File

@ -30,7 +30,9 @@ class ResourceTypeInfoWindow(popup.PopupWindow):
"""Popup window providing info about resource types."""
def __init__(self, origin_widget: ba.Widget):
scale = (2.3 if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
uiscale = ba.app.uiscale
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._transitioning_out = False
self._width = 570
self._height = 350

View File

@ -44,10 +44,12 @@ class ServerDialogWindow(ba.Window):
txt_scale)
self._width = 500
self._height = 130 + min(200, txt_height)
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition='in_scale',
scale=1.8 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0))
scale=(1.8 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0)))
self._starttime = ba.time(ba.TimeType.REAL, ba.TimeFormat.MILLISECONDS)
ba.playsound(ba.getsound('swish'))

View File

@ -53,20 +53,22 @@ class AdvancedSettingsWindow(ba.Window):
self._transition_out = 'out_right'
scale_origin = None
self._width = 870.0 if app.small_ui else 670.0
x_inset = 100 if app.small_ui else 0
self._height = (390.0
if app.small_ui else 450.0 if app.med_ui else 520.0)
uiscale = ba.app.uiscale
self._width = 870.0 if uiscale is ba.UIScale.SMALL else 670.0
x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = (390.0 if uiscale is ba.UIScale.SMALL else
450.0 if uiscale is ba.UIScale.MEDIUM else 520.0)
self._spacing = 32
self._menu_open = False
top_extra = 10 if app.small_ui else 0
top_extra = 10 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + top_extra),
transition=transition,
toolbar_visibility='menu_minimal',
scale_origin_stack_offset=scale_origin,
scale=2.06 if app.small_ui else 1.4 if app.med_ui else 1.0,
stack_offset=(0, -25) if app.small_ui else (0, 0)))
scale=(2.06 if uiscale is ba.UIScale.SMALL else
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -25) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._prev_lang = ''
self._prev_lang_list: List[str] = []
self._complete_langs_list: Optional[List] = None
@ -96,7 +98,7 @@ class AdvancedSettingsWindow(ba.Window):
self._r = 'settingsWindowAdvanced'
if app.toolbars and app.small_ui:
if app.toolbars and uiscale is ba.UIScale.SMALL:
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._do_back)
self._back_button = None

View File

@ -54,23 +54,25 @@ class AllSettingsWindow(ba.Window):
else:
self._transition_out = 'out_right'
scale_origin = None
width = 900 if ba.app.small_ui else 580
x_inset = 75 if ba.app.small_ui else 0
uiscale = ba.app.uiscale
width = 900 if uiscale is ba.UIScale.SMALL else 580
x_inset = 75 if uiscale is ba.UIScale.SMALL else 0
height = 435
# button_height = 42
self._r = 'settingsWindow'
top_extra = 20 if ba.app.small_ui else 0
top_extra = 20 if uiscale is ba.UIScale.SMALL else 0
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height + top_extra),
transition=transition,
toolbar_visibility='menu_minimal',
scale_origin_stack_offset=scale_origin,
scale=(
1.75 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0),
stack_offset=(0, -8) if ba.app.small_ui else (0, 0)))
scale=(1.75 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -8) if uiscale is ba.UIScale.SMALL else (0, 0)))
if ba.app.toolbars and ba.app.small_ui:
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
self._back_button = None
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._do_back)
@ -105,10 +107,10 @@ class AllSettingsWindow(ba.Window):
v = height - 80
v -= 145
basew = 280 if ba.app.small_ui else 230
basew = 280 if uiscale is ba.UIScale.SMALL else 230
baseh = 170
x_offs = x_inset + (105
if ba.app.small_ui else 72) - basew # now unused
x_offs = x_inset + (105 if uiscale is ba.UIScale.SMALL else
72) - basew # now unused
x_offs2 = x_offs + basew - 7
x_offs3 = x_offs + 2 * (basew - 7)
x_offs4 = x_offs2

View File

@ -74,8 +74,9 @@ class AudioSettingsWindow(ba.Window):
show_soundtracks = True
height += spacing * 2.0
base_scale = (2.05
if ba.app.small_ui else 1.6 if ba.app.med_ui else 1.0)
uiscale = ba.app.uiscale
base_scale = (2.05 if uiscale is ba.UIScale.SMALL else
1.6 if uiscale is ba.UIScale.MEDIUM else 1.0)
popup_menu_scale = base_scale * 1.2
super().__init__(root_widget=ba.containerwidget(
@ -83,7 +84,7 @@ class AudioSettingsWindow(ba.Window):
transition=transition,
scale=base_scale,
scale_origin_stack_offset=scale_origin,
stack_offset=(0, -20) if ba.app.small_ui else (0, 0)))
stack_offset=(0, -20) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._back_button = back_button = btn = ba.buttonwidget(
parent=self._root_widget,

View File

@ -144,12 +144,14 @@ class ControlsSettingsWindow(ba.Window):
if show_xinput_toggle:
height += spacing
uiscale = ba.app.uiscale
smallscale = (1.7 if show_keyboard else 2.2)
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition=transition,
scale_origin_stack_offset=scale_origin,
scale=(1.7 if show_keyboard else 2.2
) if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0))
scale=(smallscale if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0)))
self._back_button = btn = ba.buttonwidget(
parent=self._root_widget,
position=(35, height - 60),

View File

@ -60,11 +60,12 @@ class GamepadSettingsWindow(ba.Window):
self._width = 700 if self._is_secondary else 730
self._height = 440 if self._is_secondary else 450
self._spacing = 40
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
scale=(
1.63 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0),
stack_offset=(-20, -16) if ba.app.small_ui else (0, 0),
scale=(1.63 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(-20, -16) if uiscale is ba.UIScale.SMALL else (0, 0),
transition=transition))
# Don't ask to config joysticks while we're in here.
@ -782,10 +783,12 @@ class AwaitGamepadInputWindow(ba.Window):
self._capture_button = button
width = 400
height = 150
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
scale=2.0 if ba.app.small_ui else 1.9 if ba.app.med_ui else 1.0,
scale=(2.0 if uiscale is ba.UIScale.SMALL else
1.9 if uiscale is ba.UIScale.MEDIUM else 1.0),
size=(width, height),
transition='in_scale'))
transition='in_scale'), )
ba.textwidget(parent=self._root_widget,
position=(0, (height - 60) if message2 is None else
(height - 50)),

View File

@ -41,22 +41,23 @@ class GamepadAdvancedSettingsWindow(ba.Window):
app = ba.app
self._r = parent_window.get_r()
self._width = 900 if ba.app.small_ui else 700
self._x_inset = x_inset = 100 if ba.app.small_ui else 0
self._height = 402 if ba.app.small_ui else 512
uiscale = ba.app.uiscale
self._width = 900 if uiscale is ba.UIScale.SMALL else 700
self._x_inset = x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = 402 if uiscale is ba.UIScale.SMALL else 512
self._textwidgets: Dict[str, ba.Widget] = {}
super().__init__(root_widget=ba.containerwidget(
transition='in_scale',
size=(self._width, self._height),
scale=1.06 *
(1.85 if ba.app.small_ui else 1.35 if ba.app.med_ui else 1.0),
stack_offset=(0, -25) if ba.app.small_ui else (0, 0),
scale=1.06 * (1.85 if uiscale is ba.UIScale.SMALL else
1.35 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -25) if uiscale is ba.UIScale.SMALL else (0, 0),
scale_origin_stack_offset=(parent_window.get_advanced_button().
get_screen_space_center())))
ba.textwidget(parent=self._root_widget,
position=(self._width * 0.5, self._height -
(40 if ba.app.small_ui else 34)),
(40 if uiscale is ba.UIScale.SMALL else 34)),
size=(0, 0),
text=ba.Lstr(resource=self._r + '.advancedTitleText'),
maxwidth=320,
@ -67,8 +68,8 @@ class GamepadAdvancedSettingsWindow(ba.Window):
back_button = btn = ba.buttonwidget(
parent=self._root_widget,
autoselect=True,
position=(self._width - (176 + x_inset),
self._height - (60 if ba.app.small_ui else 55)),
position=(self._width - (176 + x_inset), self._height -
(60 if uiscale is ba.UIScale.SMALL else 55)),
size=(120, 48),
text_scale=0.8,
label=ba.Lstr(resource='doneText'),

View File

@ -55,8 +55,10 @@ def gamepad_configure_callback(event: Dict[str, Any]) -> None:
width = 700
height = 200
button_width = 100
uiscale = ba.app.uiscale
ba.app.main_menu_window = dlg = (ba.containerwidget(
scale=1.7 if ba.app.small_ui else 1.4 if ba.app.med_ui else 1.0,
scale=(1.7 if uiscale is ba.UIScale.SMALL else
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0),
size=(width, height),
transition='in_right'))
device_name = inputdevice.name
@ -97,10 +99,13 @@ class GamepadSelectWindow(ba.Window):
spacing = 40
self._r = 'configGamepadSelectWindow'
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
scale=2.3 if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0,
scale=(2.3 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0),
size=(width, height),
transition='in_right'))
transition='in_right',
))
btn = ba.buttonwidget(parent=self._root_widget,
position=(20, height - 60),

View File

@ -57,14 +57,14 @@ class GraphicsSettingsWindow(ba.Window):
spacing = 32
self._have_selected_child = False
interface_type = app.interface_type
uiscale = app.uiscale
width = 450.0
height = 302.0
self._show_fullscreen = False
fullscreen_spacing_top = spacing * 0.2
fullscreen_spacing = spacing * 1.2
if interface_type == 'large' and app.platform != 'android':
if uiscale == ba.UIScale.LARGE and app.platform != 'android':
self._show_fullscreen = True
height += fullscreen_spacing + fullscreen_spacing_top
@ -83,8 +83,9 @@ class GraphicsSettingsWindow(ba.Window):
show_resolution = (app.platform == 'android'
and app.subplatform == 'cardboard')
base_scale = (2.4
if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0)
uiscale = ba.app.uiscale
base_scale = (2.4 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0)
popup_menu_scale = base_scale * 1.2
v = height - 50
v -= spacing * 1.15
@ -93,7 +94,7 @@ class GraphicsSettingsWindow(ba.Window):
transition=transition,
scale_origin_stack_offset=scale_origin,
scale=base_scale,
stack_offset=(0, -30) if ba.app.small_ui else (0, 0)))
stack_offset=(0, -30) if uiscale is ba.UIScale.SMALL else (0, 0)))
btn = ba.buttonwidget(parent=self._root_widget,
position=(35, height - 50),

View File

@ -45,14 +45,16 @@ class ConfigKeyboardWindow(ba.Window):
self._displayname = ba.Lstr(translate=('inputDeviceNames', dname_raw))
self._width = 700
if self._unique_id != '#1':
self._height = 450
self._height = 480
else:
self._height = 345
self._height = 375
self._spacing = 40
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
scale=(1.6 if ba.app.small_ui else 1.3 if ba.app.med_ui else 1.0),
stack_offset=(0, -10) if ba.app.small_ui else (0, 0),
scale=(1.6 if uiscale is ba.UIScale.SMALL else
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -10) if uiscale is ba.UIScale.SMALL else (0, 0),
transition=transition))
self._rebuild_ui()
@ -73,7 +75,7 @@ class ConfigKeyboardWindow(ba.Window):
cancel_button = ba.buttonwidget(parent=self._root_widget,
autoselect=True,
position=(38, self._height - 65),
position=(38, self._height - 85),
size=(170, 60),
label=ba.Lstr(resource='cancelText'),
scale=0.9,
@ -81,9 +83,9 @@ class ConfigKeyboardWindow(ba.Window):
save_button = ba.buttonwidget(parent=self._root_widget,
autoselect=True,
position=(self._width - 190,
self._height - 65),
self._height - 85),
size=(180, 60),
label=ba.Lstr(resource='makeItSoText'),
label=ba.Lstr(resource='saveText'),
scale=0.9,
text_scale=0.9,
on_activate_call=self._save)
@ -94,7 +96,7 @@ class ConfigKeyboardWindow(ba.Window):
ba.widget(edit=cancel_button, right_widget=save_button)
ba.widget(edit=save_button, left_widget=cancel_button)
v = self._height - 54.0
v = self._height - 74.0
ba.textwidget(parent=self._root_widget,
position=(self._width * 0.5, v + 15),
size=(0, 0),
@ -270,10 +272,12 @@ class AwaitKeyboardInputWindow(ba.Window):
width = 400
height = 150
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition='in_right',
scale=2.0 if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0))
scale=(2.0 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0)))
ba.textwidget(parent=self._root_widget,
position=(0, height - 60),
size=(width, 25),

View File

@ -34,10 +34,12 @@ class PS3ControllerSettingsWindow(ba.Window):
height = 330 if _ba.is_running_on_fire_tv() else 540
spacing = 40
self._r = 'ps3ControllersWindow'
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition='in_right',
scale=1.35 if ba.app.small_ui else 1.3 if ba.app.med_ui else 1.0))
scale=(1.35 if uiscale is ba.UIScale.SMALL else
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0)))
btn = ba.buttonwidget(parent=self._root_widget,
position=(37, height - 73),

View File

@ -34,11 +34,13 @@ class RemoteAppSettingsWindow(ba.Window):
width = 700
height = 390
spacing = 40
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition='in_right',
scale=(1.85 if ba.app.small_ui else 1.3 if ba.app.med_ui else 1.0),
stack_offset=(-10, 0) if ba.app.small_ui else (0, 0)))
scale=(1.85 if uiscale is ba.UIScale.SMALL else
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(-10, 0) if uiscale is ba.UIScale.SMALL else (0, 0)))
btn = ba.buttonwidget(parent=self._root_widget,
position=(40, height - 67),
size=(140, 65),

View File

@ -39,14 +39,16 @@ class TestingWindow(ba.Window):
title: ba.Lstr,
entries: List[Dict[str, Any]],
transition: str = 'in_right'):
uiscale = ba.app.uiscale
self._width = 600
self._height = 324 if ba.app.small_ui else 400
self._height = 324 if uiscale is ba.UIScale.SMALL else 400
self._entries = copy.deepcopy(entries)
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition=transition,
scale=(2.5 if ba.app.small_ui else 1.2 if ba.app.med_ui else 1.0),
stack_offset=(0, -28) if ba.app.small_ui else (0, 0)))
scale=(2.5 if uiscale is ba.UIScale.SMALL else
1.2 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -28) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._back_button = btn = ba.buttonwidget(
parent=self._root_widget,
autoselect=True,

View File

@ -45,10 +45,12 @@ class TouchscreenSettingsWindow(ba.Window):
_ba.set_touchscreen_editing(True)
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition='in_right',
scale=1.9 if ba.app.small_ui else 1.55 if ba.app.med_ui else 1.2))
scale=(1.9 if uiscale is ba.UIScale.SMALL else
1.55 if uiscale is ba.UIScale.MEDIUM else 1.2)))
btn = ba.buttonwidget(parent=self._root_widget,
position=(55, self._height - 60),

View File

@ -39,10 +39,12 @@ class XBox360ControllerSettingsWindow(ba.Window):
width = 700
height = 300 if _ba.is_running_on_fire_tv() else 485
spacing = 40
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height),
transition='in_right',
scale=1.4 if ba.app.small_ui else 1.4 if ba.app.med_ui else 1.0))
scale=(1.4 if uiscale is ba.UIScale.SMALL else
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0)))
btn = ba.buttonwidget(parent=self._root_widget,
position=(35, height - 65),

View File

@ -38,6 +38,7 @@ class SoundtrackBrowserWindow(ba.Window):
def __init__(self,
transition: str = 'in_right',
origin_widget: ba.Widget = None):
# pylint: disable=too-many-locals
# pylint: disable=too-many-statements
# If they provided an origin-widget, scale up from that.
@ -51,10 +52,11 @@ class SoundtrackBrowserWindow(ba.Window):
scale_origin = None
self._r = 'editSoundtrackWindow'
self._width = 800 if ba.app.small_ui else 600
x_inset = 100 if ba.app.small_ui else 0
self._height = (340
if ba.app.small_ui else 370 if ba.app.med_ui else 440)
uiscale = ba.app.uiscale
self._width = 800 if uiscale is ba.UIScale.SMALL else 600
x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = (340 if uiscale is ba.UIScale.SMALL else
370 if uiscale is ba.UIScale.MEDIUM else 440)
spacing = 40.0
v = self._height - 40.0
v -= spacing * 1.0
@ -64,10 +66,11 @@ class SoundtrackBrowserWindow(ba.Window):
transition=transition,
toolbar_visibility='menu_minimal',
scale_origin_stack_offset=scale_origin,
scale=(2.3 if ba.app.small_ui else 1.6 if ba.app.med_ui else 1.0),
stack_offset=(0, -18) if ba.app.small_ui else (0, 0)))
scale=(2.3 if uiscale is ba.UIScale.SMALL else
1.6 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -18) if uiscale is ba.UIScale.SMALL else (0, 0)))
if ba.app.toolbars and ba.app.small_ui:
if ba.app.toolbars and uiscale is ba.UIScale.SMALL:
self._back_button = None
else:
self._back_button = ba.buttonwidget(
@ -98,7 +101,8 @@ class SoundtrackBrowserWindow(ba.Window):
lock_tex = ba.gettexture('lock')
self._lock_images: List[ba.Widget] = []
scl = (1.0 if ba.app.small_ui else 1.13 if ba.app.med_ui else 1.4)
scl = (1.0 if uiscale is ba.UIScale.SMALL else
1.13 if uiscale is ba.UIScale.MEDIUM else 1.4)
v -= 60.0 * scl
self._new_button = btn = ba.buttonwidget(
parent=self._root_widget,

View File

@ -43,16 +43,18 @@ class SoundtrackEditWindow(ba.Window):
self._r = 'editSoundtrackWindow'
self._folder_tex = ba.gettexture('folder')
self._file_tex = ba.gettexture('file')
self._width = 848 if ba.app.small_ui else 648
x_inset = 100 if ba.app.small_ui else 0
self._height = (395
if ba.app.small_ui else 450 if ba.app.med_ui else 560)
uiscale = ba.app.uiscale
self._width = 848 if uiscale is ba.UIScale.SMALL else 648
x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = (395 if uiscale is ba.UIScale.SMALL else
450 if uiscale is ba.UIScale.MEDIUM else 560)
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition=transition,
scale=(2.08 if ba.app.small_ui else 1.5 if ba.app.med_ui else 1.0),
stack_offset=(0, -48) if ba.app.small_ui else (
0, 15) if ba.app.med_ui else (0, 0)))
scale=(2.08 if uiscale is ba.UIScale.SMALL else
1.5 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -48) if uiscale is ba.UIScale.SMALL else (
0, 15) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
cancel_button = ba.buttonwidget(parent=self._root_widget,
position=(38 + x_inset,
self._height - 60),

View File

@ -64,10 +64,12 @@ class SoundtrackEntryTypeSelectWindow(ba.Window):
if do_music_folder:
self._height += spacing
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition=transition,
scale=1.7 if ba.app.small_ui else 1.4 if ba.app.med_ui else 1.0))
scale=(1.7 if uiscale is ba.UIScale.SMALL else
1.4 if uiscale is ba.UIScale.MEDIUM else 1.0)))
btn = ba.buttonwidget(parent=self._root_widget,
position=(35, self._height - 65),
size=(160, 60),

View File

@ -91,11 +91,13 @@ class SpecialOfferWindow(ba.Window):
self._offer = copy.deepcopy(offer)
self._width = 580
self._height = 590
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition=transition,
scale=(1.2 if ba.app.small_ui else 1.15 if ba.app.med_ui else 1.0),
stack_offset=(0, -15) if ba.app.small_ui else (0, 0)))
scale=(1.2 if uiscale is ba.UIScale.SMALL else
1.15 if uiscale is ba.UIScale.MEDIUM else 1.0),
stack_offset=(0, -15) if uiscale is ba.UIScale.SMALL else (0, 0)))
self._is_bundle_sale = False
try:
if offer['item'] in ['pro', 'pro_fullprice']:

View File

@ -39,9 +39,10 @@ class StoreBrowserWindow(ba.Window):
"""Window for browsing the store."""
def _update_get_tickets_button_pos(self) -> None:
uiscale = ba.app.uiscale
if self._get_tickets_button:
pos = (self._width - 252 -
(self._x_inset + (47 if ba.app.small_ui
(self._x_inset + (47 if uiscale is ba.UIScale.SMALL
and _ba.is_party_icon_visible() else 0)),
self._height - 70)
ba.buttonwidget(edit=self._get_tickets_button, position=pos)
@ -59,6 +60,7 @@ class StoreBrowserWindow(ba.Window):
from ba import SpecialChar
app = ba.app
uiscale = app.uiscale
ba.set_analytics_screen('Store Window')
@ -81,11 +83,12 @@ class StoreBrowserWindow(ba.Window):
self._on_close_call = on_close_call
self._show_tab = show_tab
self._modal = modal
self._width = 1240 if app.small_ui else 1040
self._x_inset = x_inset = 100 if app.small_ui else 0
self._height = (578 if app.small_ui else 645 if app.med_ui else 800)
self._width = 1240 if uiscale is ba.UIScale.SMALL else 1040
self._x_inset = x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = (578 if uiscale is ba.UIScale.SMALL else
645 if uiscale is ba.UIScale.MEDIUM else 800)
self._current_tab: Optional[str] = None
extra_top = 30 if app.small_ui else 0
extra_top = 30 if uiscale is ba.UIScale.SMALL else 0
self._request: Any = None
self._r = 'store'
@ -95,12 +98,11 @@ class StoreBrowserWindow(ba.Window):
size=(self._width, self._height + extra_top),
transition=transition,
toolbar_visibility='menu_full',
scale=1.3 if app.small_ui else 0.9 if app.med_ui else 0.8,
scale=(1.3 if uiscale is ba.UIScale.SMALL else
0.9 if uiscale is ba.UIScale.MEDIUM else 0.8),
scale_origin_stack_offset=scale_origin,
stack_offset=(0,
-5) if app.small_ui else (0,
0) if app.med_ui else (0,
0)))
stack_offset=((0, -5) if uiscale is ba.UIScale.SMALL else (
0, 0) if uiscale is ba.UIScale.MEDIUM else (0, 0))))
self._back_button = btn = ba.buttonwidget(
parent=self._root_widget,
@ -718,6 +720,8 @@ class StoreBrowserWindow(ba.Window):
self._sections = copy.deepcopy(store_data[sdata['tab']])
self._height: Optional[float] = None
uiscale = ba.app.uiscale
# Pre-calc a few things and add them to store-data.
for section in self._sections:
if self._tab == 'characters':
@ -739,8 +743,9 @@ class StoreBrowserWindow(ba.Window):
section['x_offs'] = (130 if self._tab == 'extras' else
270 if self._tab == 'maps' else 0)
section['y_offs'] = (
55 if (self._tab == 'extras' and ba.app.small_ui)
else -20 if self._tab == 'icons' else 0)
55 if (self._tab == 'extras'
and uiscale is ba.UIScale.SMALL) else
-20 if self._tab == 'icons' else 0)
def instantiate(self, scrollwidget: ba.Widget,
tab_button: ba.Widget) -> None:

View File

@ -43,7 +43,9 @@ class TeamNamesColorsWindow(popup.PopupWindow):
self._max_name_length = 16
# Creates our _root_widget.
scale = (1.69 if ba.app.small_ui else 1.1 if ba.app.med_ui else 0.85)
uiscale = ba.app.uiscale
scale = (1.69 if uiscale is ba.UIScale.SMALL else
1.1 if uiscale is ba.UIScale.MEDIUM else 0.85)
super().__init__(position=scale_origin,
size=(self._width, self._height),
scale=scale)

View File

@ -34,10 +34,12 @@ class TelnetAccessRequestWindow(ba.Window):
height = 100
text = ba.Lstr(resource='telnetAccessText')
uiscale = ba.app.uiscale
super().__init__(root_widget=ba.containerwidget(
size=(width, height + 40),
transition='in_right',
scale=1.7 if ba.app.small_ui else 1.3 if ba.app.med_ui else 1.0))
scale=(1.7 if uiscale is ba.UIScale.SMALL else
1.3 if uiscale is ba.UIScale.MEDIUM else 1.0)))
padding = 20
ba.textwidget(parent=self._root_widget,
position=(padding, padding + 33),

View File

@ -43,8 +43,9 @@ class TournamentEntryWindow(popup.PopupWindow):
scale: float = None,
offset: Tuple[float, float] = (0.0, 0.0),
on_close_call: Callable[[], Any] = None):
# needs some tidying
# Needs some tidying.
# pylint: disable=too-many-branches
# pylint: disable=too-many-locals
# pylint: disable=too-many-statements
ba.set_analytics_screen('Tournament Entry Window')
@ -77,8 +78,9 @@ class TournamentEntryWindow(popup.PopupWindow):
self._on_close_call = on_close_call
if scale is None:
scale = (2.3
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
uiscale = ba.app.uiscale
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._delegate = delegate
self._transitioning_out = False

View File

@ -53,14 +53,15 @@ class TournamentScoresWindow(popup_ui.PopupWindow):
self._tournament_id = tournament_id
self._subcontainer: Optional[ba.Widget] = None
self._on_close_call = on_close_call
uiscale = ba.app.uiscale
if scale is None:
scale = (2.3
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._transitioning_out = False
self._width = 400
self._height = (300
if ba.app.small_ui else 370 if ba.app.med_ui else 450)
self._height = (300 if uiscale is ba.UIScale.SMALL else
370 if uiscale is ba.UIScale.MEDIUM else 450)
bg_color = (0.5, 0.4, 0.6)

View File

@ -40,9 +40,10 @@ class TrophiesWindow(popup.PopupWindow):
scale: float = None):
from ba.deprecated import get_resource
self._data = data
uiscale = ba.app.uiscale
if scale is None:
scale = (2.3
if ba.app.small_ui else 1.65 if ba.app.med_ui else 1.23)
scale = (2.3 if uiscale is ba.UIScale.SMALL else
1.65 if uiscale is ba.UIScale.MEDIUM else 1.23)
self._transitioning_out = False
self._width = 300
self._height = 300

View File

@ -34,14 +34,15 @@ class ShowURLWindow(ba.Window):
# in some cases we might want to show it as a qr code
# (for long URLs especially)
app = ba.app
uiscale = app.uiscale
if app.platform == 'android' and app.subplatform == 'alibaba':
self._width = 500
self._height = 500
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height),
transition='in_right',
scale=(1.25 if ba.app.small_ui else 1.25 if ba.app.
med_ui else 1.25)))
scale=(1.25 if uiscale is ba.UIScale.SMALL else
1.25 if uiscale is ba.UIScale.MEDIUM else 1.25)))
self._cancel_button = ba.buttonwidget(
parent=self._root_widget,
position=(50, self._height - 30),
@ -68,8 +69,8 @@ class ShowURLWindow(ba.Window):
self._root_widget = ba.containerwidget(
size=(self._width, self._height + 40),
transition='in_right',
scale=1.25
if ba.app.small_ui else 1.25 if ba.app.med_ui else 1.25)
scale=(1.25 if uiscale is ba.UIScale.SMALL else
1.25 if uiscale is ba.UIScale.MEDIUM else 1.25))
ba.textwidget(parent=self._root_widget,
position=(self._width * 0.5, self._height - 10),
size=(0, 0),

View File

@ -60,23 +60,25 @@ class WatchWindow(ba.Window):
self._my_replays_rename_window: Optional[ba.Widget] = None
self._my_replay_rename_text: Optional[ba.Widget] = None
self._r = 'watchWindow'
self._width = 1240 if ba.app.small_ui else 1040
x_inset = 100 if ba.app.small_ui else 0
self._height = (578
if ba.app.small_ui else 670 if ba.app.med_ui else 800)
uiscale = ba.app.uiscale
self._width = 1240 if uiscale is ba.UIScale.SMALL else 1040
x_inset = 100 if uiscale is ba.UIScale.SMALL else 0
self._height = (578 if uiscale is ba.UIScale.SMALL else
670 if uiscale is ba.UIScale.MEDIUM else 800)
self._current_tab: Optional[str] = None
extra_top = 20 if ba.app.small_ui else 0
extra_top = 20 if uiscale is ba.UIScale.SMALL else 0
super().__init__(root_widget=ba.containerwidget(
size=(self._width, self._height + extra_top),
transition=transition,
toolbar_visibility='menu_minimal',
scale_origin_stack_offset=scale_origin,
scale=(1.3 if ba.app.small_ui else 0.97 if ba.app.med_ui else 0.8),
stack_offset=(0, -10) if ba.app.small_ui else (
0, 15) if ba.app.med_ui else (0, 0)))
scale=(1.3 if uiscale is ba.UIScale.SMALL else
0.97 if uiscale is ba.UIScale.MEDIUM else 0.8),
stack_offset=(0, -10) if uiscale is ba.UIScale.SMALL else (
0, 15) if uiscale is ba.UIScale.MEDIUM else (0, 0)))
if ba.app.small_ui and ba.app.toolbars:
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
ba.containerwidget(edit=self._root_widget,
on_cancel_call=self._back)
self._back_button = None
@ -122,7 +124,7 @@ class WatchWindow(ba.Window):
if ba.app.toolbars:
ba.widget(edit=self._tab_buttons[tabs_def[-1][0]],
right_widget=_ba.get_special_widget('party_button'))
if ba.app.small_ui:
if uiscale is ba.UIScale.SMALL:
bbtn = _ba.get_special_widget('back_button')
ba.widget(edit=self._tab_buttons[tabs_def[0][0]],
up_widget=bbtn,
@ -172,12 +174,13 @@ class WatchWindow(ba.Window):
# switching to a different tab
self._tab_data = {}
uiscale = ba.app.uiscale
if tab == 'my_replays':
c_width = self._scroll_width
c_height = self._scroll_height - 20
sub_scroll_height = c_height - 63
self._my_replays_scroll_width = sub_scroll_width = (
680 if ba.app.small_ui else 640)
680 if uiscale is ba.UIScale.SMALL else 640)
self._tab_container = cnt = ba.containerwidget(
parent=self._root_widget,
@ -202,19 +205,20 @@ class WatchWindow(ba.Window):
ba.Lstr(resource='replayNameDefaultText'))
]))
b_width = 140 if ba.app.small_ui else 178
b_height = (107
if ba.app.small_ui else 142 if ba.app.med_ui else 190)
b_space_extra = (0 if ba.app.small_ui else
-2 if ba.app.med_ui else -5)
b_width = 140 if uiscale is ba.UIScale.SMALL else 178
b_height = (107 if uiscale is ba.UIScale.SMALL else
142 if uiscale is ba.UIScale.MEDIUM else 190)
b_space_extra = (0 if uiscale is ba.UIScale.SMALL else
-2 if uiscale is ba.UIScale.MEDIUM else -5)
b_color = (0.6, 0.53, 0.63)
b_textcolor = (0.75, 0.7, 0.8)
btnv = c_height - (48 if ba.app.small_ui else
45 if ba.app.med_ui else 40) - b_height
btnh = 40 if ba.app.small_ui else 40
smlh = 190 if ba.app.small_ui else 225
tscl = 1.0 if ba.app.small_ui else 1.2
btnv = (c_height - (48 if uiscale is ba.UIScale.SMALL else
45 if uiscale is ba.UIScale.MEDIUM else 40) -
b_height)
btnh = 40 if uiscale is ba.UIScale.SMALL else 40
smlh = 190 if uiscale is ba.UIScale.SMALL else 225
tscl = 1.0 if uiscale is ba.UIScale.SMALL else 1.2
self._my_replays_watch_replay_button = btn1 = ba.buttonwidget(
parent=cnt,
size=(b_width, b_height),
@ -227,7 +231,7 @@ class WatchWindow(ba.Window):
label=ba.Lstr(resource=self._r + '.watchReplayButtonText'),
autoselect=True)
ba.widget(edit=btn1, up_widget=self._tab_buttons[tab])
if ba.app.small_ui and ba.app.toolbars:
if uiscale is ba.UIScale.SMALL and ba.app.toolbars:
ba.widget(edit=btn1,
left_widget=_ba.get_special_widget('back_button'))
btnv -= b_height + b_space_extra
@ -309,8 +313,10 @@ class WatchWindow(ba.Window):
return
c_width = 600
c_height = 250
uiscale = ba.app.uiscale
self._my_replays_rename_window = cnt = ba.containerwidget(
scale=1.8 if ba.app.small_ui else 1.55 if ba.app.med_ui else 1.0,
scale=(1.8 if uiscale is ba.UIScale.SMALL else
1.55 if uiscale is ba.UIScale.MEDIUM else 1.0),
size=(c_width, c_height),
transition='in_scale')
dname = self._get_replay_display_name(self._my_replay_selected)

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-07-11 for Ballistica version 1.5.20 build 20132</em></h4>
<h4><em>last updated on 2020-07-12 for Ballistica version 1.5.20 build 20133</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>
@ -191,6 +191,7 @@
<li><a href="#class_ba_SpecialChar">ba.SpecialChar</a></li>
<li><a href="#class_ba_TimeFormat">ba.TimeFormat</a></li>
<li><a href="#class_ba_TimeType">ba.TimeType</a></li>
<li><a href="#class_ba_UIScale">ba.UIScale</a></li>
</ul>
<h4><a name="class_category_Exception_Classes">Exception Classes</a></h4>
<ul>
@ -805,7 +806,7 @@ likely result in errors.</p>
</p>
<h3>Attributes:</h3>
<h5><a href="#attr_ba_App__api_version">api_version</a>, <a href="#attr_ba_App__build_number">build_number</a>, <a href="#attr_ba_App__config">config</a>, <a href="#attr_ba_App__config_file_path">config_file_path</a>, <a href="#attr_ba_App__debug_build">debug_build</a>, <a href="#attr_ba_App__interface_type">interface_type</a>, <a href="#attr_ba_App__language">language</a>, <a href="#attr_ba_App__locale">locale</a>, <a href="#attr_ba_App__on_tv">on_tv</a>, <a href="#attr_ba_App__platform">platform</a>, <a href="#attr_ba_App__python_directory_app">python_directory_app</a>, <a href="#attr_ba_App__python_directory_app_site">python_directory_app_site</a>, <a href="#attr_ba_App__python_directory_user">python_directory_user</a>, <a href="#attr_ba_App__subplatform">subplatform</a>, <a href="#attr_ba_App__test_build">test_build</a>, <a href="#attr_ba_App__ui_bounds">ui_bounds</a>, <a href="#attr_ba_App__user_agent_string">user_agent_string</a>, <a href="#attr_ba_App__version">version</a>, <a href="#attr_ba_App__vr_mode">vr_mode</a></h5>
<h5><a href="#attr_ba_App__api_version">api_version</a>, <a href="#attr_ba_App__build_number">build_number</a>, <a href="#attr_ba_App__config">config</a>, <a href="#attr_ba_App__config_file_path">config_file_path</a>, <a href="#attr_ba_App__debug_build">debug_build</a>, <a href="#attr_ba_App__language">language</a>, <a href="#attr_ba_App__locale">locale</a>, <a href="#attr_ba_App__on_tv">on_tv</a>, <a href="#attr_ba_App__platform">platform</a>, <a href="#attr_ba_App__python_directory_app">python_directory_app</a>, <a href="#attr_ba_App__python_directory_app_site">python_directory_app_site</a>, <a href="#attr_ba_App__python_directory_user">python_directory_user</a>, <a href="#attr_ba_App__subplatform">subplatform</a>, <a href="#attr_ba_App__test_build">test_build</a>, <a href="#attr_ba_App__ui_bounds">ui_bounds</a>, <a href="#attr_ba_App__uiscale">uiscale</a>, <a href="#attr_ba_App__user_agent_string">user_agent_string</a>, <a href="#attr_ba_App__version">version</a>, <a href="#attr_ba_App__vr_mode">vr_mode</a></h5>
<dl>
<dt><h4><a name="attr_ba_App__api_version">api_version</a></h4></dt><dd>
<p><span>int</span></p>
@ -844,18 +845,6 @@ likely result in errors.</p>
builds due to compiler optimizations being disabled and extra
checks being run.</p>
</dd>
<dt><h4><a name="attr_ba_App__interface_type">interface_type</a></h4></dt><dd>
<p><span>str</span></p>
<p>Interface mode the game is in; can be 'large', 'medium', or 'small'.</p>
<p> 'large' is used by system such as desktop PC where elements on screen
remain usable even at small sizes, allowing more to be shown.
'small' is used by small devices such as phones, where elements on
screen must be larger to remain readable and usable.
'medium' is used by tablets and other middle-of-the-road situations
such as VR or TV.</p>
</dd>
<dt><h4><a name="attr_ba_App__language">language</a></h4></dt><dd>
<p><span>str</span></p>
@ -923,6 +912,11 @@ likely result in errors.</p>
<p> This tuple contains: (x-min, x-max, y-min, y-max)</p>
</dd>
<dt><h4><a name="attr_ba_App__uiscale">uiscale</a></h4></dt><dd>
<p><span><a href="#class_ba_UIScale">ba.UIScale</a></span></p>
<p>Current ui scale for the app.</p>
</dd>
<dt><h4><a name="attr_ba_App__user_agent_string">user_agent_string</a></h4></dt><dd>
<p><span>str</span></p>
@ -5658,6 +5652,35 @@ self.t = <a href="#class_ba_Timer">ba.Timer</a>(0.3, say_it, repeat=True)
</dd>
</dl>
<hr>
<h2><strong><a name="class_ba_UIScale">ba.UIScale</a></strong></h3>
<p>Inherits from: enum.Enum</p>
<p>The overall scale the UI is being rendered for. Note that this is
independent of pixel resolution. For example, a phone and a desktop PC
might render the game at similar pixel resolutions but the size they
display content at will vary significantly.</p>
<p>Category: <a href="#class_category_Enums">Enums</a></p>
<p> 'large' is used for devices such as desktop PCs where fine details can
be clearly seen. UI elements are generally smaller on the screen
and more content can be seen at once.</p>
<p> 'medium' is used for devices such as tablets, TVs, or VR headsets.
This mode strikes a balance between clean readability and amount of
content visible.</p>
<p> 'small' is used primarily for phones or other small devices where
content needs to be presented as large and clear in order to remain
readable from an average distance.
</p>
<h3>Values:</h3>
<ul>
<li>LARGE</li>
<li>MEDIUM</li>
<li>SMALL</li>
</ul>
<hr>
<h2><strong><a name="class_ba_Vec3">ba.Vec3</a></strong></h3>
<p><em>&lt;top level class&gt;</em>
</p>