From 8e5621fe977778ca5e0f78d0a2f954b43b354e49 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 1 May 2023 21:24:16 +0800 Subject: [PATCH] fix: some lib path and import error --- Difficult_Rocket/__init__.py | 1 - Difficult_Rocket/api/__init__.py | 5 +++-- Difficult_Rocket/api/exception/__init__.py | 5 +++++ Difficult_Rocket/client/__init__.py | 13 +++++++++---- build_rs.ps1 | 2 +- .../lib/Difficult_Rocket_rs.cp38-win_amd64.pyd | 4 ++-- mods/dr_game/__init__.py | 2 +- 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Difficult_Rocket/__init__.py b/Difficult_Rocket/__init__.py index d9f5b50..9b2616f 100644 --- a/Difficult_Rocket/__init__.py +++ b/Difficult_Rocket/__init__.py @@ -4,7 +4,6 @@ # All rights reserved # ------------------------------- -import os import sys import warnings import importlib diff --git a/Difficult_Rocket/api/__init__.py b/Difficult_Rocket/api/__init__.py index eac38b4..647bc4f 100644 --- a/Difficult_Rocket/api/__init__.py +++ b/Difficult_Rocket/api/__init__.py @@ -11,6 +11,7 @@ github: @shenjackyuanjie gitee: @shenjackyuanjie """ -# 单独导入的(或者就这一个有用的) +from typing import TYPE_CHECKING -# lazy之后之前全部导入的(太多了写不动__all__了 +if TYPE_CHECKING: + from Difficult_Rocket.api import delivery, screen, mod, exception diff --git a/Difficult_Rocket/api/exception/__init__.py b/Difficult_Rocket/api/exception/__init__.py index 8fcca51..05239ad 100644 --- a/Difficult_Rocket/api/exception/__init__.py +++ b/Difficult_Rocket/api/exception/__init__.py @@ -10,3 +10,8 @@ mail: 3695888@qq.com github: @shenjackyuanjie gitee: @shenjackyuanjie """ + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from Difficult_Rocket.api.exception import command, logger, main, threading, unsupport diff --git a/Difficult_Rocket/client/__init__.py b/Difficult_Rocket/client/__init__.py index b9433bb..ee71612 100644 --- a/Difficult_Rocket/client/__init__.py +++ b/Difficult_Rocket/client/__init__.py @@ -161,6 +161,7 @@ class ClientWindow(Window): self.game = game self.net_mode = net_mode self.run_input = False + self.command_list: List[str] = [] # configs self.main_config = tools.load_file('./configs/main.toml') self.game_config = tools.load_file('./configs/game.config') @@ -228,10 +229,11 @@ class ClientWindow(Window): continue if get == 'stop': self.run_input = False - try: - self.on_command(line.CommandText(get)) - except CommandError: - self.logger.error(traceback.format_exc()) + self.command_list.append(get) + # try: + # self.on_command(line.CommandText(get)) + # except CommandError: + # self.logger.error(traceback.format_exc()) self.logger.debug('read_input end') @new_thread('window save_info') @@ -263,6 +265,9 @@ class ClientWindow(Window): @_call_screen_after def on_draw(self, *dt): + if self.command_list: + for command in self.command_list: + self.on_command(line.CommandText(command)) # self.logger.debug('on_draw call dt: {}'.format(dt)) pyglet.gl.glClearColor(0.1, 0, 0, 0.0) self.clear() diff --git a/build_rs.ps1 b/build_rs.ps1 index 2ce11e2..07b8c6c 100644 --- a/build_rs.ps1 +++ b/build_rs.ps1 @@ -23,6 +23,6 @@ if ($do -or "311" -in $args) { python3.11 setup.py build } -python3 post_build.py +python3.8 post_build.py Set-Location ..\..\..\ diff --git a/libs/Difficult_Rocket_rs/lib/Difficult_Rocket_rs.cp38-win_amd64.pyd b/libs/Difficult_Rocket_rs/lib/Difficult_Rocket_rs.cp38-win_amd64.pyd index 87e3213..92a505e 100644 --- a/libs/Difficult_Rocket_rs/lib/Difficult_Rocket_rs.cp38-win_amd64.pyd +++ b/libs/Difficult_Rocket_rs/lib/Difficult_Rocket_rs.cp38-win_amd64.pyd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b19a52878b8290578d90aba8cea77fcceb9d064fa266ef0b1bdc514802a6f8b -size 1477632 +oid sha256:b87767f49fc2670e55497ca14925e0f100947d882d791f16d067669ac77ab5eb +size 1427968 diff --git a/mods/dr_game/__init__.py b/mods/dr_game/__init__.py index 0fae9d5..c24dc9d 100644 --- a/mods/dr_game/__init__.py +++ b/mods/dr_game/__init__.py @@ -10,7 +10,7 @@ import traceback from typing import Optional -from MCDR.version import Version +from libs.MCDR.version import Version from Difficult_Rocket.main import Game from Difficult_Rocket.api.mod import ModInfo from Difficult_Rocket.api.types import Options