import carb
import omni.kit.actions.core


def register_actions(extension_id, get_self_fn):
    action_registry = omni.kit.actions.core.get_action_registry()
    actions_tag = "About Actions"

    omni.kit.actions.core.get_action_registry().register_action(
        extension_id,
        "toggle_window",
        get_self_fn().toggle_window,
        display_name="Help->Toggle About Window",
        description="Toggle About",
        tag=actions_tag,
    )

    omni.kit.actions.core.get_action_registry().register_action(
        extension_id,
        "show_window",
        lambda v=True: get_self_fn().show(v),
        display_name="Help->Show About Window",
        description="Show About",
        tag=actions_tag,
    )

    omni.kit.actions.core.get_action_registry().register_action(
        extension_id,
        "hide_window",
        lambda v=False: get_self_fn().show(v),
        display_name="Help->Hide About Window",
        description="Hide About",
        tag=actions_tag,
    )

def deregister_actions(extension_id):
    action_registry = omni.kit.actions.core.get_action_registry()
    action_registry.deregister_all_actions_for_extension(extension_id)
