diff --git a/Makefile b/Makefile index 118f6e49..bc3eb668 100644 --- a/Makefile +++ b/Makefile @@ -339,8 +339,6 @@ pycharm-full: prereqs ################################################################################ # Run all tests. (live execution verification) -# Note: need to disable bytecode writing so we don't cause errors due to -# unexpected __pycache__ dirs popping up. test: prereqs @tools/snippets pytest -v tests diff --git a/assets/src/ba_data/python/ba/_assetmanager.py b/assets/src/ba_data/python/ba/_assetmanager.py index 69da0579..88f50409 100644 --- a/assets/src/ba_data/python/ba/_assetmanager.py +++ b/assets/src/ba_data/python/ba/_assetmanager.py @@ -115,7 +115,7 @@ class AssetManager: def load_state(self) -> None: """Loads state from disk. Resets to default state if unable to.""" - print('AMAN LOADING STATE') + print('ASSET-MANAGER LOADING STATE') try: state_path = self.state_path if state_path.exists(): @@ -129,7 +129,7 @@ class AssetManager: def save_state(self) -> None: """Save state to disk (if possible).""" - print('AMAN SAVING STATE') + print('ASSET-MANAGER SAVING STATE') try: with open(self.state_path, 'w') as outfile: outfile.write(self._state.to_json_str()) @@ -138,27 +138,35 @@ class AssetManager: class AssetGather: - """Wrangles a gather of assets.""" + """Wrangles a gathering of assets.""" def __init__(self, manager: AssetManager) -> None: assert threading.get_ident() == manager.thread_ident self._manager = weakref.ref(manager) - self._valid = True + # self._valid = True print('AssetGather()') # url = 'https://files.ballistica.net/bombsquad/promo/BSGamePlay.mov' - url = 'http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz' - fetch_url(url, - filename=Path(manager.rootdir, 'testdl'), - asset_gather=self) - print('fetch success') + # url = 'http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz' + # fetch_url(url, + # filename=Path(manager.rootdir, 'testdl'), + # asset_gather=self) + # print('fetch success') + thread = threading.Thread(target=self._run) + thread.run() - @property - def valid(self) -> bool: - """Whether this gather is still valid. + def _run(self) -> None: + """Run the gather in a background thread.""" + print('hello from gather bg') - A gather becomes in valid if its originating AssetManager dies. - """ - return True + # First, do some sort of. + + # @property + # def valid(self) -> bool: + # """Whether this gather is still valid. + + # A gather becomes in valid if its originating AssetManager dies. + # """ + # return True def __del__(self) -> None: print('~AssetGather()') diff --git a/docs/ba_module.md b/docs/ba_module.md index 4f09ec43..ef3f8229 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-03-22 for Ballistica version 1.5.0 build 20001

+

last updated on 2020-03-26 for Ballistica version 1.5.0 build 20001

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 let me know. Happy modding!


diff --git a/tests/test_ba/test_assetmanager.py b/tests/test_ba/test_assetmanager.py index d324d075..133dcc9b 100644 --- a/tests/test_ba/test_assetmanager.py +++ b/tests/test_ba/test_assetmanager.py @@ -45,7 +45,6 @@ def test_assetmanager() -> None: manager = AssetManager(rootdir=Path(tmpdir)) wref = weakref.ref(manager) manager.start() - gather = manager.launch_gather(packages=['a@2'], flavor=AssetPackageFlavor.DESKTOP, account_token='dummytoken')