From 2dc50fc08ce5d9eded295b4f6d5a2b5ef5bc8f0c Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 7 Jun 2021 09:57:59 +0800 Subject: [PATCH] bugfix --- kivyblocks/blocks.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/kivyblocks/blocks.py b/kivyblocks/blocks.py index 190ca1f..9c81318 100755 --- a/kivyblocks/blocks.py +++ b/kivyblocks/blocks.py @@ -408,10 +408,6 @@ class Blocks(EventDispatcher): def blocksAction(self,widget,desc, *args): target = Blocks.getWidgetById(desc.get('target','self'),widget) - if target is None: - Logger.info('Block: blocksAction():desc(%s) target not found', - str(desc)) - return add_mode = desc.get('mode','replace') opts = desc.get('options').copy() d = self.getActionData(widget,desc) @@ -420,9 +416,10 @@ class Blocks(EventDispatcher): p.update(d) opts['options'] = p def doit(target,add_mode,o,w): - if add_mode == 'replace': - target.clear_widgets() - target.add_widget(w) + if target: + if add_mode == 'replace': + target.clear_widgets() + target.add_widget(w) def doerr(o,e): Logger.info('Block: blocksAction(): desc=%s widgetBuild error' @@ -436,10 +433,6 @@ class Blocks(EventDispatcher): def urlwidgetAction(self,widget,desc, *args): target = Blocks.getWidgetById(desc.get('target','self'),widget) - if target is None: - Logger.info('Block: urlwidgetAction():desc(%s) target not found', - str(desc)) - return add_mode = desc.get('mode','replace') opts = desc.get('options').copy() p = opts.get('params',{}).copy() @@ -455,9 +448,10 @@ class Blocks(EventDispatcher): } def doit(target,add_mode,o,w): - if add_mode == 'replace': - target.clear_widgets() - target.add_widget(w) + if target: + if add_mode == 'replace': + target.clear_widgets() + target.add_widget(w) def doerr(o,e): Logger.info('Block: urlwidgetAction(): desc=%s widgetBuild error'