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)