This commit is contained in:
yumoqing 2021-01-31 17:22:50 +08:00
parent 804c0357b1
commit 774bd8cc67
2 changed files with 25 additions and 6 deletions

View File

@ -1,6 +1,26 @@
# from appPublic.background import Background
from threading import Thread
from kivy.event import EventDispatcher
from appPublic.background import Background
class BackendFunction(EventDispatcher, Background):
def __init__(self, func, *args, **kw):
self.fu
class BackendFunction(EventDispatcher, Thread):
def __init__(self, callee, *args, **kw):
EventDispatcher.__init__(self)
Thread.__init__(self)
self._callee = callee
self._args = args
self._kw = kw
self.register_event_type('on_success')
self.register_event_type('on_failed')
def on_success(self, ret):
print('BackendFunction(), on_success fired')
def on_failed(self, e):
print('BackendFunciton(), on_failed fired', e)
def run(self):
try:
x = self._callee(*self._args, **self._kw)
self.dispatch('on_success', x)
except Exception as e:
self.dispatch('on_failed',e)

View File

@ -219,7 +219,7 @@ class Blocks(EventDispatcher):
try:
hc = HttpClient()
resp=hc(url,method=method,params=params,files=files)
print('Blocks.py :resp=',resp)
# print('Blocks.py :resp=',resp)
return resp
except Exception as e:
if errback:
@ -612,7 +612,6 @@ class Blocks(EventDispatcher):
if Window.fullscreen == True:
w = app.fs_widget
if w:
print('full screen ...............................')
return find_widget_by_id(id, w)
return None
ids = id.split('.')