mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-27 09:23:12 +08:00
polishing up add-to-favorites party menu entry
This commit is contained in:
parent
a2b9c0bfad
commit
ab8e33fddd
4
.efrocachemap
generated
4
.efrocachemap
generated
@ -430,12 +430,12 @@
|
||||
"build/assets/ba_data/data/languages/czech.json": "cd21ad8c6b8e9ed700284cf1e1aecbf8",
|
||||
"build/assets/ba_data/data/languages/danish.json": "3fd69080783d5c9dcc0af737f02b6f1e",
|
||||
"build/assets/ba_data/data/languages/dutch.json": "22b44a33bf81142ba2befad14eb5746e",
|
||||
"build/assets/ba_data/data/languages/english.json": "6a3fab4fb8b2879e00ed9877709bf504",
|
||||
"build/assets/ba_data/data/languages/english.json": "1cce51fed3b59b354007a0ebf256b330",
|
||||
"build/assets/ba_data/data/languages/esperanto.json": "0e397cfa5f3fb8cef5f4a64f21cda880",
|
||||
"build/assets/ba_data/data/languages/filipino.json": "e750fb1a95e4c5611115f9ece9ecab53",
|
||||
"build/assets/ba_data/data/languages/french.json": "163362f7b33866ef069cae62d0387551",
|
||||
"build/assets/ba_data/data/languages/german.json": "450fa41ae264f29a5d1af22143d0d0ad",
|
||||
"build/assets/ba_data/data/languages/gibberish.json": "25fcb5130fae56985bee175aa19f86a2",
|
||||
"build/assets/ba_data/data/languages/gibberish.json": "199c5399693834abd5dbe6724b8b68a9",
|
||||
"build/assets/ba_data/data/languages/greek.json": "287c0ec437b38772284ef9d3e4fb2fc3",
|
||||
"build/assets/ba_data/data/languages/hindi.json": "8848f6b0caec0fcf9d85bc6e683809ec",
|
||||
"build/assets/ba_data/data/languages/hungarian.json": "796a290a8c44a1e7635208c2ff5fdc6e",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
### 1.7.32 (build 21735, api 8, 2023-12-19)
|
||||
- Added an 'Add to Favorites' entry to the party menu (Thanks vishal332008!)
|
||||
|
||||
### 1.7.31 (build 21727, api 8, 2023-12-17)
|
||||
- Added `bascenev1.get_connection_to_host_info_2()` which is an improved
|
||||
|
||||
@ -768,7 +768,7 @@ class ManualGatherTab(GatherTab):
|
||||
if num_of_fav == 0:
|
||||
bui.textwidget(
|
||||
edit=self._no_parties_added_text,
|
||||
text=bui.Lstr(resource='noPartiesAddedText'),
|
||||
text=bui.Lstr(resource='gatherWindow.noPartiesAddedText'),
|
||||
)
|
||||
|
||||
def on_deactivate(self) -> None:
|
||||
@ -836,7 +836,9 @@ class ManualGatherTab(GatherTab):
|
||||
config.commit()
|
||||
bui.getsound('gunCocking').play()
|
||||
bui.screenmessage(
|
||||
bui.Lstr(resource='addedToFavoritesText'),
|
||||
bui.Lstr(
|
||||
resource='addedToFavoritesText', subs=[('${NAME}', addr)]
|
||||
),
|
||||
color=(0, 1, 0),
|
||||
)
|
||||
else:
|
||||
|
||||
@ -229,6 +229,23 @@ class PartyWindow(bui.Window):
|
||||
is_muted = bui.app.config.resolve('Chat Muted')
|
||||
assert bui.app.classic is not None
|
||||
uiscale = bui.app.ui_v1.uiscale
|
||||
|
||||
choices: list[str] = ['unmute' if is_muted else 'mute']
|
||||
choices_display: list[bui.Lstr] = [
|
||||
bui.Lstr(resource='chatUnMuteText' if is_muted else 'chatMuteText')
|
||||
]
|
||||
|
||||
# Allow the 'Add to Favorites' option only if we're actually
|
||||
# connected to a party and if it doesn't seem to be a private
|
||||
# party (those are dynamically assigned addresses and ports so
|
||||
# it makes no sense to save them).
|
||||
server_info = bs.get_connection_to_host_info_2()
|
||||
if server_info is not None and not server_info.name.startswith(
|
||||
'Private Party '
|
||||
):
|
||||
choices.append('add_to_favorites')
|
||||
choices_display.append(bui.Lstr(resource='addToFavoritesText'))
|
||||
|
||||
PopupMenuWindow(
|
||||
position=self._menu_button.get_screen_space_center(),
|
||||
scale=(
|
||||
@ -238,13 +255,8 @@ class PartyWindow(bui.Window):
|
||||
if uiscale is bui.UIScale.MEDIUM
|
||||
else 1.23
|
||||
),
|
||||
choices=['unmute' if is_muted else 'mute', 'add_to_favorites'],
|
||||
choices_display=[
|
||||
bui.Lstr(
|
||||
resource='chatUnMuteText' if is_muted else 'chatMuteText'
|
||||
),
|
||||
bui.Lstr(resource='AddToFavoritesText'),
|
||||
],
|
||||
choices=choices,
|
||||
choices_display=choices_display,
|
||||
current_choice='unmute' if is_muted else 'mute',
|
||||
delegate=self,
|
||||
)
|
||||
@ -480,9 +492,12 @@ class PartyWindow(bui.Window):
|
||||
port_num=info.port,
|
||||
)
|
||||
else:
|
||||
# We should not allow the user to see this option
|
||||
# if they aren't in a server; this is our bad.
|
||||
bui.screenmessage(
|
||||
bui.Lstr(resource='NotConnectedToServerText')
|
||||
bui.Lstr(resource='errorText'), color=(1, 0, 0)
|
||||
)
|
||||
bui.getsound('error').play()
|
||||
else:
|
||||
print(f'unhandled popup type: {self._popup_type}')
|
||||
|
||||
@ -505,6 +520,11 @@ class PartyWindow(bui.Window):
|
||||
)
|
||||
bui.getsound('error').play()
|
||||
return
|
||||
|
||||
# Avoid empty names.
|
||||
if not name:
|
||||
name = f'{addr}@{port}'
|
||||
|
||||
config = bui.app.config
|
||||
|
||||
if addr:
|
||||
@ -518,7 +538,9 @@ class PartyWindow(bui.Window):
|
||||
config.commit()
|
||||
bui.getsound('gunCocking').play()
|
||||
bui.screenmessage(
|
||||
bui.Lstr(value='Added To Favorites'),
|
||||
bui.Lstr(
|
||||
resource='addedToFavoritesText', subs=[('${NAME}', name)]
|
||||
),
|
||||
color=(0, 1, 0),
|
||||
)
|
||||
else:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user