From 03c875d13facd8fbebdf8fdcc60aa22d62235604 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: Fri, 8 Mar 2024 02:27:59 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/gui/translatorUI.py | 8 ++++++-- .../LunaTranslator/translator/basetranslator.py | 9 ++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index c9f1ee46..0b97c142 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -198,9 +198,13 @@ class QUnFrameWindow(resizableframeless): self.saveiterclasspointer[iter_context_class]={'curr':self.translate_text.getcurrpointer(),'start':self.translate_text.getcurrpointer()} else: currbefore=self.saveiterclasspointer[iter_context_class]['curr'] - self.document.blockSignals(True) + if globalconfig['zitiyangshi'] !=3: + #阴影字体blcoksignal会UpdateLayeredWindowIndirect failed for + #其他字体不blocksignal会高度抖动 + self.document.blockSignals(True) self.translate_text.deletebetween(self.saveiterclasspointer[iter_context_class]['start'],self.saveiterclasspointer[iter_context_class]['curr']) - self.document.blockSignals(False) + if globalconfig['zitiyangshi'] !=3: + self.document.blockSignals(False) self.translate_text.insertatpointer(self.saveiterclasspointer[iter_context_class]['start'],text) currcurrent=self.translate_text.getcurrpointer() self.saveiterclasspointer[iter_context_class]['curr']=currcurrent diff --git a/LunaTranslator/LunaTranslator/translator/basetranslator.py b/LunaTranslator/LunaTranslator/translator/basetranslator.py index 2f4a2a89..49eb0001 100644 --- a/LunaTranslator/LunaTranslator/translator/basetranslator.py +++ b/LunaTranslator/LunaTranslator/translator/basetranslator.py @@ -7,7 +7,7 @@ import os,time ,types import zhconv,gobject import sqlite3 from myutils.commonbase import commonbase - +import functools from myutils.utils import stringfyerror,autosql from myutils.commonbase import ArgsEmptyExc from myutils.wrapper import stripwrapper @@ -268,14 +268,13 @@ class basetrans(commonbase): callback(''.join(collectiterres),embedcallback,is_iter_res) if isinstance(res,types.GeneratorType): - def _iterget(): - rid=self.requestid - for i,_res in enumerate(res): + def _iterget(rid,__res): + for i,_res in enumerate(__res): if i==0:__callback('',3) if self.requestid!=rid:break __callback(_res,1) __callback('',2) - timeoutfunction(_iterget,checktutukufunction=checktutukufunction ) + timeoutfunction(functools.partial(_iterget,self.requestid,res),checktutukufunction=checktutukufunction ) else: __callback(res,0)