def wrapper(func: ACTION_FUNC) -> ACTION_FUNC: _action_table[name] = ActionTable(func=func, attr=attr) def inner_wrapper(view: View, defx: Defx, context: Context) -> None: return func(view, defx, context) return inner_wrapper
def get_actions(self) -> typing.Dict[str, ActionTable]: def predicate(o: object) -> bool: return hasattr(o, '_is_action') actions = {} for member in inspect.getmembers(self, predicate): func = member[1] actions[func._name] = ActionTable( func=partial(func._func, self), attr=func._attr) return actions
def get_actions(self) -> typing.Dict[str, ActionTable]: return { 'call': ActionTable(func=_call, attr=ActionAttr.REDRAW), 'check_redraw': ActionTable(func=_nop, attr=ActionAttr.NO_TAGETS), 'close_tree': ActionTable(func=_close_tree, attr=ActionAttr.TREE), 'multi': ActionTable(func=_multi), 'open_tree': ActionTable(func=_open_tree, attr=ActionAttr.TREE), 'open_tree_recursive': ActionTable(func=_open_tree_recursive, attr=ActionAttr.TREE), 'open_or_close_tree': ActionTable(func=_open_or_close_tree, attr=ActionAttr.TREE), 'print': ActionTable(func=_print), 'quit': ActionTable(func=_quit, attr=ActionAttr.NO_TAGETS), 'redraw': ActionTable(func=_redraw, attr=ActionAttr.NO_TAGETS), 'repeat': ActionTable(func=_repeat, attr=ActionAttr.MARK), 'search': ActionTable(func=_search, attr=ActionAttr.NO_TAGETS), 'toggle_columns': ActionTable(func=_toggle_columns, attr=ActionAttr.REDRAW), 'toggle_ignored_files': ActionTable(func=_toggle_ignored_files, attr=ActionAttr.REDRAW), 'toggle_select': ActionTable(func=_toggle_select, attr=ActionAttr.MARK | ActionAttr.NO_TAGETS), 'toggle_select_all': ActionTable(func=_toggle_select_all, attr=ActionAttr.MARK | ActionAttr.NO_TAGETS), 'toggle_sort': ActionTable(func=_toggle_sort, attr=ActionAttr.MARK | ActionAttr.NO_TAGETS), 'yank_path': ActionTable(func=_yank_path), }
def get_actions(self) -> typing.Dict[str, ActionTable]: return { 'call': ActionTable(func=_call, attr=ActionAttr.REDRAW), 'multi': ActionTable(func=_multi), 'print': ActionTable(func=_print), 'quit': ActionTable(func=_quit), 'redraw': ActionTable(func=_redraw), 'repeat': ActionTable(func=_repeat, attr=ActionAttr.MARK), 'toggle_columns': ActionTable(func=_toggle_columns, attr=ActionAttr.REDRAW), 'toggle_ignored_files': ActionTable(func=_toggle_ignored_files, attr=ActionAttr.REDRAW), 'toggle_select': ActionTable(func=_toggle_select, attr=ActionAttr.MARK), 'toggle_select_all': ActionTable(func=_toggle_select_all, attr=ActionAttr.MARK), 'toggle_sort': ActionTable(func=_toggle_sort, attr=ActionAttr.REDRAW), 'yank_path': ActionTable(func=_yank_path), }
def get_actions(self) -> typing.Dict[str, ActionTable]: actions = super().get_actions() actions.update({ 'cd': ActionTable(func=_cd), 'change_vim_cwd': ActionTable(func=_change_vim_cwd, attr=ActionAttr.NO_TAGETS), 'check_redraw': ActionTable(func=_check_redraw, attr=ActionAttr.NO_TAGETS), 'copy': ActionTable(func=_copy), 'drop': ActionTable(func=_drop), 'execute_command': ActionTable(func=_execute_command, attr=ActionAttr.NO_TAGETS), 'execute_system': ActionTable(func=_execute_system), 'move': ActionTable(func=_move), 'new_directory': ActionTable(func=_new_directory), 'new_file': ActionTable(func=_new_file), 'new_multiple_files': ActionTable(func=_new_multiple_files), 'open': ActionTable(func=_open), 'open_directory': ActionTable(func=_open_directory), 'paste': ActionTable(func=_paste, attr=ActionAttr.NO_TAGETS), 'remove': ActionTable(func=_remove, attr=ActionAttr.REDRAW), 'remove_trash': ActionTable(func=_remove_trash), 'rename': ActionTable(func=_rename), }) return actions