mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-30 11:13:17 +08:00
Syncing latest changes between public/private.
This commit is contained in:
parent
0c6e559aa6
commit
794b660dc9
2
Makefile
2
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
|
||||
|
||||
|
||||
@ -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()')
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
||||
<h4><em>last updated on 2020-03-22 for Ballistica version 1.5.0 build 20001</em></h4>
|
||||
<h4><em>last updated on 2020-03-26 for Ballistica version 1.5.0 build 20001</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>
|
||||
|
||||
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user