From 4895550fcbcc56dfcd6ee579e36fe490a2c33a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Thu, 11 Apr 2024 20:21:09 +0800 Subject: [PATCH] Update LunaTranslator.py --- LunaTranslator/LunaTranslator/LunaTranslator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/LunaTranslator/LunaTranslator/LunaTranslator.py b/LunaTranslator/LunaTranslator/LunaTranslator.py index 0548267c..637d5bd1 100644 --- a/LunaTranslator/LunaTranslator/LunaTranslator.py +++ b/LunaTranslator/LunaTranslator/LunaTranslator.py @@ -778,10 +778,11 @@ class MAINUI: try: _hwnd = windows.GetForegroundWindow() _pid = windows.GetWindowThreadProcessId(_hwnd) + try: - if ( - _pid in self.textsource.pids or _pid == os.getpid() - ): # or的顺序不可以修改 + if len(self.textsource.pids) == 0: + raise Exception() + if _pid in self.textsource.pids or _pid == os.getpid(): isok(self.textsource.pname) else: isbad()