def get_script_logger(): return getLogger(get_script_logger_name())
# -*- encoding: utf-8 -*- """ """ from youpy.tools import extended_sys_path from youpy.engine import Engine from youpy.engine import Simulation from youpy.project import Project from youpy.project import get_project_dir from youpy import logging LOGGER = logging.getLogger(__name__) def run(path, show_fps=False, fps=30, log_level=None, syslog_level=None, log_context=False): project_dir = get_project_dir(path) project = Project(project_dir) logging.init_logger(project, log_level=log_level, syslog_level=syslog_level, log_context=log_context) LOGGER.info("=" * 60) LOGGER.info(f"running {project.name}") simu = Simulation(project, show_fps=show_fps) engine = Engine(simu, target_fps=fps) with extended_sys_path(project_dir.parent): return engine.run()
import sys import traceback from random import randint from youpy import concurrency from youpy import message from youpy.logging import get_user_logger_name from youpy.logging import getLogger from inspect import signature from youpy.data import EngineSprite from youpy.data import EngineScene from youpy.data import EngineMouse LOGGER = getLogger(__name__) class ScriptSet: def __init__(self): self._scripts = {} self._done_scripts = concurrency.Queue() def bulk_trigger(self, event_handlers): for event_handler in event_handlers: self.trigger(event_handler) def trigger(self, event_handler): script_name = get_script_name(event_handler) if script_name in self._scripts: # Script already running. This may happens for example when the