feat: disable active frame rpelication during animation playback, use a timer instead

This commit is contained in:
Swann
2023-02-06 10:03:55 +08:00
parent 4c42a5be92
commit c3dcb9fc44
5 changed files with 24 additions and 10 deletions

View File

@ -30,8 +30,8 @@ VERSION_EXPR = re.compile('\d+.\d+.\d+')
DEFAULT_CACHE_DIR = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "cache")
REPLICATION_DEPENDENCIES = {
"zmq",
"deepdiff==5.7.0"
("zmq", "25.0.0"),
("deepdiff","5.7.0"),
}
LIBS = os.path.join(os.path.dirname(os.path.abspath(__file__)), "libs")
REPLICATION = os.path.join(LIBS,"replication")
@ -55,7 +55,7 @@ def install_pip():
subprocess.run([str(PYTHON_PATH), "-m", "ensurepip"])
def install_package(name: str, install_dir: str):
def install_package(name: str, version:str=None, install_dir: str=None):
logging.info(f"installing {name} version...")
env = os.environ
if "PIP_REQUIRE_VIRTUALENV" in env:
@ -65,7 +65,8 @@ def install_package(name: str, install_dir: str):
# env var for the subprocess.
env = os.environ.copy()
del env["PIP_REQUIRE_VIRTUALENV"]
subprocess.run([str(PYTHON_PATH), "-m", "pip", "install", f"{name}", "-t", install_dir], env=env)
module_name = f"{name}" if version is None else f"{name}=={version}"
subprocess.run([str(PYTHON_PATH), "-m", "pip", "install", module_name, "-t", install_dir], env=env)
if name in sys.modules:
del sys.modules[name]
@ -119,7 +120,7 @@ def remove_paths(paths: list):
sys.path.remove(path)
def install_modules(dependencies: list, python_path: str, install_dir: str):
def install_modules(dependencies: tuple, python_path: str, install_dir: str):
global PYTHON_PATH, SUBPROCESS_DIR
PYTHON_PATH = Path(python_path)
@ -128,9 +129,9 @@ def install_modules(dependencies: list, python_path: str, install_dir: str):
if not module_can_be_imported("pip"):
install_pip()
for package_name in dependencies:
for package_name, package_version in dependencies:
if not module_can_be_imported(package_name):
install_package(package_name, install_dir=install_dir)
install_package(package_name, version=package_version, install_dir=install_dir)
module_can_be_imported(package_name)
def register():