Latest public/internal sync.

This commit is contained in:
Eric 2024-03-01 18:28:46 -08:00
parent 9d173c90c9
commit a01e5608e0
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98

View File

@ -90,9 +90,7 @@ class CoopBrowserWindow(bui.Window):
self._height = ( self._height = (
657 657
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 730 else 730 if uiscale is bui.UIScale.MEDIUM else 800
if uiscale is bui.UIScale.MEDIUM
else 800
) )
app.ui_v1.set_main_menu_location('Coop Select') app.ui_v1.set_main_menu_location('Coop Select')
self._r = 'coopSelectWindow' self._r = 'coopSelectWindow'
@ -125,17 +123,13 @@ class CoopBrowserWindow(bui.Window):
stack_offset=( stack_offset=(
(0, -15) (0, -15)
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else (0, 0) else (0, 0) if uiscale is bui.UIScale.MEDIUM else (0, 0)
if uiscale is bui.UIScale.MEDIUM
else (0, 0)
), ),
transition=transition, transition=transition,
scale=( scale=(
1.2 1.2
if uiscale is bui.UIScale.SMALL if uiscale is bui.UIScale.SMALL
else 0.8 else 0.8 if uiscale is bui.UIScale.MEDIUM else 0.75
if uiscale is bui.UIScale.MEDIUM
else 0.75
), ),
) )
) )
@ -284,9 +278,11 @@ class CoopBrowserWindow(bui.Window):
self._scrollwidget = bui.scrollwidget( self._scrollwidget = bui.scrollwidget(
parent=self._root_widget, parent=self._root_widget,
highlight=False, highlight=False,
position=(65 + x_inset, 120) position=(
if uiscale is bui.UIScale.SMALL and app.ui_v1.use_toolbars (65 + x_inset, 120)
else (65 + x_inset, 70), if uiscale is bui.UIScale.SMALL and app.ui_v1.use_toolbars
else (65 + x_inset, 70)
),
size=(self._scroll_width, self._scroll_height), size=(self._scroll_width, self._scroll_height),
simple_culling_v=10.0, simple_culling_v=10.0,
claims_left_right=True, claims_left_right=True,
@ -434,12 +430,14 @@ class CoopBrowserWindow(bui.Window):
if tbtn.time_remaining_value_text is not None: if tbtn.time_remaining_value_text is not None:
bui.textwidget( bui.textwidget(
edit=tbtn.time_remaining_value_text, edit=tbtn.time_remaining_value_text,
text=bui.timestring(tbtn.time_remaining, centi=False) text=(
if ( bui.timestring(tbtn.time_remaining, centi=False)
tbtn.has_time_remaining if (
and self._tourney_data_up_to_date tbtn.has_time_remaining
) and self._tourney_data_up_to_date
else '-', )
else '-'
),
) )
# Also adjust the ad icon visibility. # Also adjust the ad icon visibility.
@ -460,9 +458,9 @@ class CoopBrowserWindow(bui.Window):
try: try:
bui.imagewidget( bui.imagewidget(
edit=self._hard_button_lock_image, edit=self._hard_button_lock_image,
opacity=0.0 opacity=(
if bui.app.classic.accounts.have_pro_options() 0.0 if bui.app.classic.accounts.have_pro_options() else 1.0
else 1.0, ),
) )
except Exception: except Exception:
logging.exception('Error updating campaign lock.') logging.exception('Error updating campaign lock.')
@ -572,12 +570,16 @@ class CoopBrowserWindow(bui.Window):
enable_sound=False, enable_sound=False,
on_activate_call=bui.Call(self._set_campaign_difficulty, 'easy'), on_activate_call=bui.Call(self._set_campaign_difficulty, 'easy'),
on_select_call=bui.Call(self.sel_change, 'campaign', 'easyButton'), on_select_call=bui.Call(self.sel_change, 'campaign', 'easyButton'),
color=sel_color color=(
if self._campaign_difficulty == 'easy' sel_color
else un_sel_color, if self._campaign_difficulty == 'easy'
textcolor=sel_textcolor else un_sel_color
if self._campaign_difficulty == 'easy' ),
else un_sel_textcolor, textcolor=(
sel_textcolor
if self._campaign_difficulty == 'easy'
else un_sel_textcolor
),
) )
bui.widget(edit=self._easy_button, show_buffer_left=100) bui.widget(edit=self._easy_button, show_buffer_left=100)
if self._selected_campaign_level == 'easyButton': if self._selected_campaign_level == 'easyButton':
@ -598,12 +600,16 @@ class CoopBrowserWindow(bui.Window):
enable_sound=False, enable_sound=False,
on_activate_call=bui.Call(self._set_campaign_difficulty, 'hard'), on_activate_call=bui.Call(self._set_campaign_difficulty, 'hard'),
on_select_call=bui.Call(self.sel_change, 'campaign', 'hardButton'), on_select_call=bui.Call(self.sel_change, 'campaign', 'hardButton'),
color=sel_color_hard color=(
if self._campaign_difficulty == 'hard' sel_color_hard
else un_sel_color, if self._campaign_difficulty == 'hard'
textcolor=sel_textcolor else un_sel_color
if self._campaign_difficulty == 'hard' ),
else un_sel_textcolor, textcolor=(
sel_textcolor
if self._campaign_difficulty == 'hard'
else un_sel_textcolor
),
) )
self._hard_button_lock_image = bui.imagewidget( self._hard_button_lock_image = bui.imagewidget(
parent=parent_widget, parent=parent_widget,
@ -973,35 +979,43 @@ class CoopBrowserWindow(bui.Window):
for i, tbutton in enumerate(self._tournament_buttons): for i, tbutton in enumerate(self._tournament_buttons):
bui.widget( bui.widget(
edit=tbutton.button, edit=tbutton.button,
up_widget=self._tournament_info_button up_widget=(
if i == 0 self._tournament_info_button
else self._tournament_buttons[i - 1].button, if i == 0
down_widget=self._tournament_buttons[(i + 1)].button else self._tournament_buttons[i - 1].button
if i + 1 < len(self._tournament_buttons) ),
else custom_h_scroll, down_widget=(
self._tournament_buttons[(i + 1)].button
if i + 1 < len(self._tournament_buttons)
else custom_h_scroll
),
) )
bui.widget( bui.widget(
edit=tbutton.more_scores_button, edit=tbutton.more_scores_button,
down_widget=self._tournament_buttons[ down_widget=(
(i + 1) self._tournament_buttons[(i + 1)].current_leader_name_text
].current_leader_name_text if i + 1 < len(self._tournament_buttons)
if i + 1 < len(self._tournament_buttons) else custom_h_scroll
else custom_h_scroll, ),
) )
bui.widget( bui.widget(
edit=tbutton.current_leader_name_text, edit=tbutton.current_leader_name_text,
up_widget=self._tournament_info_button up_widget=(
if i == 0 self._tournament_info_button
else self._tournament_buttons[i - 1].more_scores_button, if i == 0
else self._tournament_buttons[i - 1].more_scores_button
),
) )
for btn in self._custom_buttons: for btn in self._custom_buttons:
try: try:
bui.widget( bui.widget(
edit=btn.get_button(), edit=btn.get_button(),
up_widget=tournament_h_scroll up_widget=(
if self._tournament_buttons tournament_h_scroll
else self._tournament_info_button, if self._tournament_buttons
else self._tournament_info_button
),
) )
except Exception: except Exception:
logging.exception('Error wiring up custom buttons.') logging.exception('Error wiring up custom buttons.')
@ -1055,8 +1069,9 @@ class CoopBrowserWindow(bui.Window):
def _switch_to_score( def _switch_to_score(
self, self,
show_tab: StoreBrowserWindow.TabID show_tab: (
| None = StoreBrowserWindow.TabID.EXTRAS, StoreBrowserWindow.TabID | None
) = StoreBrowserWindow.TabID.EXTRAS,
) -> None: ) -> None:
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from bauiv1lib.account import show_sign_in_prompt from bauiv1lib.account import show_sign_in_prompt