From 0e84605796f3917b1e50b36b8046edec8f4f8b2d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 4 Jul 2021 18:51:38 +0800 Subject: [PATCH] bugfix --- kivyblocks/blocks.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/kivyblocks/blocks.py b/kivyblocks/blocks.py index 2564335..ad64dc1 100755 --- a/kivyblocks/blocks.py +++ b/kivyblocks/blocks.py @@ -477,13 +477,17 @@ class Blocks(EventDispatcher): if dwidget is None: Logger.info('Block: desc(%s) datawidget not defined', str(desc)) - if hasattr(dwidget,'getValue'): - data = dwidget.getValue() + method = desc.get('datamethod','getValue') + largs = desc.get('dataargs',[]), + kwargs = desc.get('datakwargs',{}) + if hasattr(dwidget, method): + f = getattr(dwidget, method) + data = f(**kwargs) if desc.get('keymapping'): data = keyMapping(data, desc.get('keymapping')) else: - Logger.info('Block: desc(%s) datawidget has not getValue', - str(desc)) + Logger.info('Block: desc(%s) datawidget has not %s', + str(desc), method) return data def registedfunctionAction(self, widget, desc, *args):