From 893912fae346cc98e5f94f4d0fefc1e5934fc389 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 17 Jun 2023 00:51:05 +0800 Subject: [PATCH] replace runtime import [build skip] [build rs skip] --- Difficult_Rocket/client/__init__.py | 6 +++--- Difficult_Rocket/crash/__init__.py | 3 ++- Difficult_Rocket/utils/translate.py | 3 ++- mods/dr_game/__init__.py | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Difficult_Rocket/client/__init__.py b/Difficult_Rocket/client/__init__.py index 7346b96..fe72e57 100644 --- a/Difficult_Rocket/client/__init__.py +++ b/Difficult_Rocket/client/__init__.py @@ -30,10 +30,10 @@ from pyglet.window import key, mouse if TYPE_CHECKING: from Difficult_Rocket.main import Game from Difficult_Rocket.utils import tools -from Difficult_Rocket.api.types import Options from Difficult_Rocket.command import line +from Difficult_Rocket.api.types import Options from Difficult_Rocket.utils.translate import tr -from Difficult_Rocket import DR_runtime +from Difficult_Rocket.runtime import DR_runtime from Difficult_Rocket.api.screen import BaseScreen from Difficult_Rocket.utils.thread import new_thread from Difficult_Rocket.client.fps.fps_log import FpsLogger @@ -51,7 +51,7 @@ class ClientOption(Options): resizeable: bool = True visible: bool = True gui_scale: float = 1.0 - caption: str = "Difficult Rocket v{DR_version}|DR_rs v{DR_Rust_get_version}" + caption: str = "Difficult Rocket v{DR_version}" def load_file(self) -> None: file: dict = tools.load_file('./configs/main.toml') diff --git a/Difficult_Rocket/crash/__init__.py b/Difficult_Rocket/crash/__init__.py index daad3ae..034c9cd 100644 --- a/Difficult_Rocket/crash/__init__.py +++ b/Difficult_Rocket/crash/__init__.py @@ -99,7 +99,8 @@ def write_cache(cache_stream, crash_info): def write_info_to_cache(cache_stream): # 运行状态信息 - from Difficult_Rocket import DR_status, DR_runtime + from Difficult_Rocket import DR_status + from Difficult_Rocket.runtime import DR_runtime cache_stream.write(Run_message) cache_stream.write(markdown_line_handler(f'DR Version: {Difficult_Rocket.game_version}', level=1)) cache_stream.write(markdown_line_handler(f'DR language: {DR_runtime.language}', level=1)) diff --git a/Difficult_Rocket/utils/translate.py b/Difficult_Rocket/utils/translate.py index e7ffaa6..e245a54 100644 --- a/Difficult_Rocket/utils/translate.py +++ b/Difficult_Rocket/utils/translate.py @@ -17,8 +17,9 @@ import inspect from dataclasses import dataclass from typing import Union, Tuple, Any, List, Dict, Hashable, Optional -from Difficult_Rocket import DR_runtime, DR_status +from Difficult_Rocket import DR_status from Difficult_Rocket.utils import tools +from Difficult_Rocket.runtime import DR_runtime from Difficult_Rocket.exception.language import (LanguageNotFound, TranslateKeyNotFound) diff --git a/mods/dr_game/__init__.py b/mods/dr_game/__init__.py index ebd731e..8b808a7 100644 --- a/mods/dr_game/__init__.py +++ b/mods/dr_game/__init__.py @@ -12,8 +12,8 @@ from typing import Optional from Difficult_Rocket import DR_status from Difficult_Rocket.main import Game from Difficult_Rocket.api.mod import ModInfo -from Difficult_Rocket.api.types import Options, Version from Difficult_Rocket.client import ClientWindow +from Difficult_Rocket.api.types import Options, Version DR_rust_version = Version("0.2.10.1") # DR_mod 的 Rust 编写部分的兼容版本