Lines Matching defs:action
8 Each action consists of a function, that processes the SP layout json file and
27 Wraps action function with its configuration.
29 def __init__(self, action, exec_order=DEFAULT_ACTION_ORDER, global_action=True, log_calls = False):
31 self.__name__ = action.__name__
32 def logged_action(action):
34 print(f"Calling {action.__name__} -> {sp}")
35 return action(sp_layout, sp, args)
37 self.action = logged_action(action) if log_calls is True else action
48 Calls action function.
50 return self.action(sp_layout, sp, args)
54 Pretty format to show debug information about the action.
63 Function decorator that registers and configures action.
68 :param log_calls - at every call to action, a useful log will be printed.
69 :param exec_order - action's calling order.
71 def append_action(action):
72 action = _ConfiguredAction(action, exec_order, global_action, log_calls)
73 bisect.insort(SpSetupActions.actions, action)
74 return action
90 def append_called(action, sp, args :dict):
91 args["called"].append(f"{action.__name__} -> {sp}")
94 for action in SpSetupActions.actions:
96 print(f"Calling {action}")
97 if action.global_action:
99 args = action(sp_layout, scope, args)
100 args = append_called(action, scope, args)
105 args = action(sp_layout, sp, args)
106 args = append_called(action, sp, args)
144 return args # Always return args in action function.
151 # 'args' can be extended in the action functions.