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