mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
stream interrupt
This commit is contained in:
parent
230423fc83
commit
07071ed64e
@ -74,9 +74,7 @@ class QUnFrameWindow(resizableframeless):
|
||||
try:
|
||||
if len(iter_res_info):
|
||||
starting,klass=iter_res_info
|
||||
print(starting,klass,res)
|
||||
if not starting:
|
||||
print(self.saveiterclasspointer[klass])
|
||||
self.translate_text.insertatpointer(self.saveiterclasspointer[klass],res)
|
||||
self.saveiterclasspointer[klass]=self.translate_text.getcurrpointer()
|
||||
return
|
||||
|
@ -79,6 +79,7 @@ class basetrans(commonbase):
|
||||
self._safe_private_init()
|
||||
|
||||
self.lastrequesttime=0
|
||||
self.requestid=0
|
||||
self._cache={}
|
||||
|
||||
self.newline=None
|
||||
@ -248,9 +249,9 @@ class basetrans(commonbase):
|
||||
if is_auto_run and self.onlymanual:
|
||||
continue
|
||||
|
||||
|
||||
self.requestid+=1
|
||||
try:
|
||||
checktutukufunction=lambda:( (embedcallback is not None) or self.queue.empty()) and self.using
|
||||
checktutukufunction=lambda:( (embedcallback is not None) or self.queue.empty()) and self.using
|
||||
if checktutukufunction():
|
||||
def reinitandtrans():
|
||||
if self.needreinit:
|
||||
@ -266,8 +267,13 @@ class basetrans(commonbase):
|
||||
callback(_,embedcallback,is_iter_res)
|
||||
collectiterres.append(_)
|
||||
if isinstance(res,types.GeneratorType):
|
||||
for _res in res:
|
||||
__callback(_res,True)
|
||||
def _iterget():
|
||||
rid=self.requestid
|
||||
for _res in res:
|
||||
if self.requestid!=rid:break
|
||||
__callback(_res,True)
|
||||
timeoutfunction(_iterget,checktutukufunction=checktutukufunction )
|
||||
|
||||
else:
|
||||
__callback(res,False)
|
||||
self.cachesetatend(contentsolved,''.join(collectiterres))
|
||||
|
Loading…
x
Reference in New Issue
Block a user