Skip to content

Commit

Permalink
more client-server work
Browse files Browse the repository at this point in the history
  • Loading branch information
efroemling committed Nov 22, 2024
1 parent 69aaf6d commit ab25bd5
Show file tree
Hide file tree
Showing 28 changed files with 206 additions and 197 deletions.
74 changes: 37 additions & 37 deletions .efrocachemap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### 1.7.37 (build 22105, api 9, 2024-11-19)
### 1.7.37 (build 22106, api 9, 2024-11-22)
- Bumping api version to 9. As you'll see below, there's some UI changes that
will require a bit of work for any UI mods to adapt to. If your mods don't
touch UI stuff at all you can simply bump your api version and call it a day.
Expand Down
2 changes: 2 additions & 0 deletions src/assets/.asset_manifest_public.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"ba_data/python/babase/__pycache__/_general.cpython-312.opt-1.pyc",
"ba_data/python/babase/__pycache__/_hooks.cpython-312.opt-1.pyc",
"ba_data/python/babase/__pycache__/_language.cpython-312.opt-1.pyc",
"ba_data/python/babase/__pycache__/_logging.cpython-312.opt-1.pyc",
"ba_data/python/babase/__pycache__/_login.cpython-312.opt-1.pyc",
"ba_data/python/babase/__pycache__/_math.cpython-312.opt-1.pyc",
"ba_data/python/babase/__pycache__/_meta.cpython-312.opt-1.pyc",
Expand Down Expand Up @@ -52,6 +53,7 @@
"ba_data/python/babase/_general.py",
"ba_data/python/babase/_hooks.py",
"ba_data/python/babase/_language.py",
"ba_data/python/babase/_logging.py",
"ba_data/python/babase/_login.py",
"ba_data/python/babase/_math.py",
"ba_data/python/babase/_meta.py",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ SCRIPT_TARGETS_PY_PUBLIC = \
$(BUILD_DIR)/ba_data/python/babase/_general.py \
$(BUILD_DIR)/ba_data/python/babase/_hooks.py \
$(BUILD_DIR)/ba_data/python/babase/_language.py \
$(BUILD_DIR)/ba_data/python/babase/_logging.py \
$(BUILD_DIR)/ba_data/python/babase/_login.py \
$(BUILD_DIR)/ba_data/python/babase/_math.py \
$(BUILD_DIR)/ba_data/python/babase/_meta.py \
Expand Down Expand Up @@ -464,6 +465,7 @@ SCRIPT_TARGETS_PYC_PUBLIC = \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_general.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_hooks.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_language.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_logging.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_login.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_math.cpython-312.opt-1.pyc \
$(BUILD_DIR)/ba_data/python/babase/__pycache__/_meta.cpython-312.opt-1.pyc \
Expand Down
12 changes: 6 additions & 6 deletions src/assets/ba_data/python/babase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
# dependency loops. The exception is TYPE_CHECKING blocks and
# annotations since those aren't evaluated at runtime.

import logging
from efro.util import set_canonical_module_names


import _babase
from _babase import (
add_clean_frame_callback,
allows_ticket_sales,
android_get_external_files_dir,
app_instance_uuid,
appname,
appnameupper,
apptime,
Expand Down Expand Up @@ -114,6 +113,7 @@
unlock_all_input,
update_internal_logger_levels,
user_agent_string,
user_ran_commands,
Vec3,
workspaces_in_use,
)
Expand Down Expand Up @@ -172,10 +172,9 @@
get_type_name,
)
from babase._language import Lstr, LanguageSubsystem
from babase._logging import balog, lifecyclelog
from babase._login import LoginAdapter, LoginInfo

# noinspection PyProtectedMember
# (PyCharm inspection bug?)
from babase._mgen.enums import (
Permission,
SpecialChar,
Expand All @@ -190,8 +189,6 @@
from babase._stringedit import StringEditAdapter, StringEditSubsystem
from babase._text import timestring

# Our standard set of loggers.
balog = logging.getLogger('ba')

_babase.app = app = App()
app.postinit()
Expand All @@ -213,6 +210,7 @@
'AppIntentDefault',
'AppIntentExec',
'AppMode',
'app_instance_uuid',
'appname',
'appnameupper',
'AppModeSelector',
Expand Down Expand Up @@ -287,6 +285,7 @@
'is_point_in_box',
'is_xcode_build',
'LanguageSubsystem',
'lifecyclelog',
'lock_all_input',
'LoginAdapter',
'LoginInfo',
Expand Down Expand Up @@ -356,6 +355,7 @@
'unlock_all_input',
'update_internal_logger_levels',
'user_agent_string',
'user_ran_commands',
'utf8_all',
'Vec3',
'vec3validate',
Expand Down
27 changes: 14 additions & 13 deletions src/assets/ba_data/python/babase/_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from babase._stringedit import StringEditSubsystem
from babase._devconsole import DevConsoleSubsystem
from babase._appconfig import AppConfig
from babase._logging import lifecyclelog

if TYPE_CHECKING:
import asyncio
Expand Down Expand Up @@ -871,7 +872,7 @@ def _on_running(self) -> None:
def _apply_app_config(self) -> None:
assert _babase.in_logic_thread()

_babase.lifecyclelog('apply-app-config')
lifecyclelog.info('apply-app-config')

# If multiple apply calls have been made, only actually apply
# once.
Expand Down Expand Up @@ -903,7 +904,7 @@ def _update_state(self) -> None:
if self._native_shutdown_complete_called:
if self.state is not self.State.SHUTDOWN_COMPLETE:
self.state = self.State.SHUTDOWN_COMPLETE
_babase.lifecyclelog(f'app-state is now {self.state.name}')
lifecyclelog.info('app-state is now %s', self.state.name)
self._on_shutdown_complete()

# Shutdown trumps all. Though we can't start shutting down until
Expand All @@ -913,7 +914,7 @@ def _update_state(self) -> None:
# Entering shutdown state:
if self.state is not self.State.SHUTTING_DOWN:
self.state = self.State.SHUTTING_DOWN
_babase.lifecyclelog(f'app-state is now {self.state.name}')
lifecyclelog.info('app-state is now %s', self.state.name)
self._on_shutting_down()

elif self._native_suspended:
Expand All @@ -930,7 +931,7 @@ def _update_state(self) -> None:
if self._initial_sign_in_completed and self._meta_scan_completed:
if self.state != self.State.RUNNING:
self.state = self.State.RUNNING
_babase.lifecyclelog(f'app-state is now {self.state.name}')
lifecyclelog.info('app-state is now %s', self.state.name)
if not self._called_on_running:
self._called_on_running = True
self._on_running()
Expand All @@ -939,7 +940,7 @@ def _update_state(self) -> None:
elif self._init_completed:
if self.state is not self.State.LOADING:
self.state = self.State.LOADING
_babase.lifecyclelog(f'app-state is now {self.state.name}')
lifecyclelog.info('app-state is now %s', self.state.name)
if not self._called_on_loading:
self._called_on_loading = True
self._on_loading()
Expand All @@ -948,7 +949,7 @@ def _update_state(self) -> None:
elif self._native_bootstrapping_completed:
if self.state is not self.State.INITING:
self.state = self.State.INITING
_babase.lifecyclelog(f'app-state is now {self.state.name}')
lifecyclelog.info('app-state is now %s', self.state.name)
if not self._called_on_initing:
self._called_on_initing = True
self._on_initing()
Expand All @@ -957,7 +958,7 @@ def _update_state(self) -> None:
elif self._native_start_called:
if self.state is not self.State.NATIVE_BOOTSTRAPPING:
self.state = self.State.NATIVE_BOOTSTRAPPING
_babase.lifecyclelog(f'app-state is now {self.state.name}')
lifecyclelog.info('app-state is now %s', self.state.name)
else:
# Only logical possibility left is NOT_STARTED, in which
# case we should not be getting called.
Expand Down Expand Up @@ -1068,10 +1069,10 @@ async def _wait_for_shutdown_suppressions(self) -> None:

# Spin and wait for anything blocking shutdown to complete.
starttime = _babase.apptime()
_babase.lifecyclelog('shutdown-suppress-wait begin')
lifecyclelog.info('shutdown-suppress-wait begin')
while _babase.shutdown_suppress_count() > 0:
await asyncio.sleep(0.001)
_babase.lifecyclelog('shutdown-suppress-wait end')
lifecyclelog.info('shutdown-suppress-wait end')
duration = _babase.apptime() - starttime
if duration > 1.0:
logging.warning(
Expand All @@ -1084,7 +1085,7 @@ async def _fade_and_shutdown_graphics(self) -> None:
import asyncio

# Kick off a short fade and give it time to complete.
_babase.lifecyclelog('fade-and-shutdown-graphics begin')
lifecyclelog.info('fade-and-shutdown-graphics begin')
_babase.fade_screen(False, time=0.15)
await asyncio.sleep(0.15)

Expand All @@ -1093,19 +1094,19 @@ async def _fade_and_shutdown_graphics(self) -> None:
_babase.graphics_shutdown_begin()
while not _babase.graphics_shutdown_is_complete():
await asyncio.sleep(0.01)
_babase.lifecyclelog('fade-and-shutdown-graphics end')
lifecyclelog.info('fade-and-shutdown-graphics end')

async def _fade_and_shutdown_audio(self) -> None:
import asyncio

# Tell the audio system to go down and give it a bit of
# time to do so gracefully.
_babase.lifecyclelog('fade-and-shutdown-audio begin')
lifecyclelog.info('fade-and-shutdown-audio begin')
_babase.audio_shutdown_begin()
await asyncio.sleep(0.15)
while not _babase.audio_shutdown_is_complete():
await asyncio.sleep(0.01)
_babase.lifecyclelog('fade-and-shutdown-audio end')
lifecyclelog.info('fade-and-shutdown-audio end')

def _threadpool_no_wait_done(self, fut: Future) -> None:
try:
Expand Down
11 changes: 11 additions & 0 deletions src/assets/ba_data/python/babase/_logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Released under the MIT License. See LICENSE for details.
#
"""Logging functionality."""

from __future__ import annotations

import logging

# Our standard set of loggers.
balog = logging.getLogger('ba')
lifecyclelog = logging.getLogger('ba.lifecycle')
5 changes: 3 additions & 2 deletions src/assets/ba_data/python/baclassic/_appmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""Contains ClassicAppMode."""
from __future__ import annotations

import os
import logging
from functools import partial
from typing import TYPE_CHECKING, override
Expand Down Expand Up @@ -157,8 +158,8 @@ def update_for_primary_account(
"""Update subscriptions/etc. for a new primary account state."""
assert in_logic_thread()

# Test subscription.
if bool(False):
# For testing subscription functionality.
if os.environ.get('BA_SUBSCRIPTION_TEST') == '1':
assert app.plus is not None
if account is None:
self._test_sub = None
Expand Down
Loading

0 comments on commit ab25bd5

Please sign in to comment.