diff --git a/LunaTranslator/LunaTranslator/textsource/texthook.py b/LunaTranslator/LunaTranslator/textsource/texthook.py index b59c9de0..e8f2e582 100644 --- a/LunaTranslator/LunaTranslator/textsource/texthook.py +++ b/LunaTranslator/LunaTranslator/textsource/texthook.py @@ -446,8 +446,11 @@ class texthook(basetext): _data, tms = self.newline_delaywait.get() collector.append(_data) - now = time.time() - time.sleep(min(now - tms, self.config["textthreaddelay"])/1000) + targettime = tms + self.config["textthreaddelay"] + sleepdur = targettime - time.time() + sleepdur = max(0, sleepdur) + sleepdur /= 1000 + time.sleep(sleepdur) if not self.newline_delaywait.empty(): continue diff --git a/build.py b/build.py index 9bdbc154..1c83336e 100644 --- a/build.py +++ b/build.py @@ -289,4 +289,5 @@ if __name__ == "__main__": subprocess.run(f"{py37Path} -m pip install -r requirements.txt") # 3.8之后会莫名其妙引用这个b东西,然后这个b东西会把一堆没用的东西导入进来 shutil.rmtree(os.path.join(os.path.dirname(py37Path), "Lib\\test")) + shutil.rmtree(os.path.join(os.path.dirname(py37Path), "Lib\\unittest")) subprocess.run(f"{py37Path} retrieval.py")