From 01442309d9ba158d86aa0661b2c8552a30436c07 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 13 Oct 2023 15:53:33 +0800 Subject: [PATCH] bugfix --- kivyblocks/dg.py | 2 +- kivyblocks/eventhandler.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 kivyblocks/eventhandler.py diff --git a/kivyblocks/dg.py b/kivyblocks/dg.py index 0a2b7a3..526b0e0 100755 --- a/kivyblocks/dg.py +++ b/kivyblocks/dg.py @@ -26,7 +26,7 @@ from appPublic.myTE import string_template_render from .utils import * from .baseWidget import Text, HBox, VBox from .scrollpanel import ScrollPanel -from .paging import Paging, RelatedLoader +from .paging import RelatedLoader from .ready import WidgetReady from .toolbar import Toolbar from .bgcolorbehavior import BGColorBehavior diff --git a/kivyblocks/eventhandler.py b/kivyblocks/eventhandler.py new file mode 100644 index 0000000..9f07f54 --- /dev/null +++ b/kivyblocks/eventhandler.py @@ -0,0 +1,12 @@ +import inspect +import asyncio +from functools improt wraps + +def eventhandler(func): + @wraps(func) + def wrapper_func(*args, **kw): + if inspect.inspect.iscoroutinefunction(func): + return asyncio.gather(func(*args, **kw)) + return func(*args, **kw) + return wrapper_func +