This commit is contained in:
yumoqing 2021-01-17 09:51:04 +08:00
parent 02619b154b
commit d90131c193

View File

@ -397,7 +397,8 @@ class Blocks(EventDispatcher):
opts = desc.get('options').copy() opts = desc.get('options').copy()
d = self.getActionData(widget,desc) d = self.getActionData(widget,desc)
p = opts.get('options',{}).copy() p = opts.get('options',{}).copy()
p.update(d) if d:
p.update(d)
opts['options'] = p opts['options'] = p
def doit(target,add_mode,o,w): def doit(target,add_mode,o,w):
if add_mode == 'replace': if add_mode == 'replace':
@ -483,7 +484,8 @@ class Blocks(EventDispatcher):
params = desc.get('params',{}).copy() params = desc.get('params',{}).copy()
d = self.getActionData(widget,desc) d = self.getActionData(widget,desc)
params.update(d) if d:
params.update(d)
func(target, *args, **params) func(target, *args, **params)
def scriptAction(self, widget, desc, *args): def scriptAction(self, widget, desc, *args):
@ -502,7 +504,8 @@ class Blocks(EventDispatcher):
"self":target, "self":target,
"args":args "args":args
} }
ns.update(d) if d:
ns.update(d)
try: try:
self.eval(script, ns) self.eval(script, ns)
except Exception as e: except Exception as e:
@ -520,7 +523,8 @@ class Blocks(EventDispatcher):
f = getattr(target, method) f = getattr(target, method)
kwargs = desc.get('options',{}).copy() kwargs = desc.get('options',{}).copy()
d = self.getActionData(widget,desc) d = self.getActionData(widget,desc)
kwargs.update(d) if d:
kwargs.update(d)
f(*args, **kwargs) f(*args, **kwargs)
else: else:
alert('%s method not found' % method) alert('%s method not found' % method)