This commit is contained in:
恍兮惚兮 2024-03-08 02:27:59 +08:00
parent fa0e70ac98
commit 03c875d13f
2 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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)