src/aoikhotkey/hotkey_parser.py
def _hotkey_expand(hotkey, vk_expand):
    """
    Expand given virtual key list to multiple virtual key lists.

    Expansion is needed because some virtual keys are one-to-many.
    E.g. [CTRL, A] -> [[LCTRL, A], [RCTRL, A]]

    :param hotkey: Virtual key list.

    :param vk_expand: Virtual key expand function.

    :return: A list of virtual key lists.
    """
    # Hotkey list.
    # Each hotkey is a virtual key list.
    # The one empty list inside is for code at 4EWMS.
    hotkey_s = [[]]

    # For given virtual key list's each virtual key
    for vk in hotkey:
        # Expand the virtual key.
        # May be None.
        exp_vk_s = vk_expand(vk)

        # If the expanded result is None,
        # or the expanded result is the original virtual key.
        if (exp_vk_s is None) or (exp_vk_s is vk):
            # Create expanded list containing only the original virtual key
            exp_vk_s = [vk]

        # If the expanded result is not None or the original virtual key
        else:
            # Use the expanded list
            exp_vk_s = exp_vk_s

        # New hotkey list
        new_hotkey_s = []

        # For the expanded list's each virtual key
        for exp_vk in exp_vk_s:
            # 4EWMS
            # For the hotkey list's each hotkey
            for old_hotkey in hotkey_s:
                # Copy the hotkey
                new_hotkey = copy(old_hotkey)

                # Append the virtual key in the expanded list to the hotkey
                new_hotkey.append(exp_vk)

                # Add the new hotkey to the new hotkey list
                new_hotkey_s.append(new_hotkey)

        # Store the new hotkey list
        hotkey_s = new_hotkey_s

    # Return the expanded hotkey list
    return hotkey_s

    Expand given virtual key list to multiple virtual key lists.

    Expansion is needed because some virtual keys are one-to-many.
    E.g. [CTRL, A] -> [[LCTRL, A], [RCTRL, A]]

    :param hotkey: Virtual key list.

    :param vk_expand: Virtual key expand function.

    :return: A list of virtual key lists.
    
Expand given virtual key list to multiple virtual key lists.
Expansion is needed because some virtual keys are one-to-many.
Expand given virtual key list to multiple virtual key lists . Expansion is needed because some virtual keys are one - to - many .
def _hotkey_expand(hotkey, vk_expand):
    hotkey_s = [[]]
    for vk in hotkey:
        exp_vk_s = vk_expand(vk)
        if (exp_vk_s is None) or (exp_vk_s is vk):
            exp_vk_s = [vk]
        else:
            exp_vk_s = exp_vk_s
        new_hotkey_s = []
        for exp_vk in exp_vk_s:
            for old_hotkey in hotkey_s:
                new_hotkey = copy(old_hotkey)
                new_hotkey.append(exp_vk)
                new_hotkey_s.append(new_hotkey)
        hotkey_s = new_hotkey_s
    return hotkey_s
def _hotkey_expand ( hotkey , vk_expand ) : hotkey_s = [ [ ] ] for vk in hotkey : exp_vk_s = vk_expand ( vk ) if ( exp_vk_s is None ) or ( exp_vk_s is vk ) : exp_vk_s = [ vk ] else : exp_vk_s = exp_vk_s new_hotkey_s = [ ] for exp_vk in exp_vk_s : for old_hotkey in hotkey_s : new_hotkey = copy ( old_hotkey ) new_hotkey . append ( exp_vk ) new_hotkey_s . append ( new_hotkey ) hotkey_s = new_hotkey_s return hotkey_s
Expand given virtual key list to multiple virtual key lists.
Expand given virtual key list to multiple virtual key lists .
"""
    Expand given virtual key list to multiple virtual key lists.

    Expansion is needed because some virtual keys are one-to-many.
    E.g. [CTRL, A] -> [[LCTRL, A], [RCTRL, A]]

    :param hotkey: Virtual key list.

    :param vk_expand: Virtual key expand function.

    :return: A list of virtual key lists.
    """ # Hotkey list. # Each hotkey is a virtual key list. # The one empty list inside is for code at 4EWMS. # For given virtual key list's each virtual key # Expand the virtual key. # May be None. # If the expanded result is None, # or the expanded result is the original virtual key. # Create expanded list containing only the original virtual key # If the expanded result is not None or the original virtual key # Use the expanded list # New hotkey list # For the expanded list's each virtual key # 4EWMS # For the hotkey list's each hotkey # Copy the hotkey # Append the virtual key in the expanded list to the hotkey # Add the new hotkey to the new hotkey list # Store the new hotkey list # Return the expanded hotkey list
A list of virtual key lists.
A list of virtual key lists .
hotkey
Virtual key list.
Virtual key list .
vk_expand
Virtual key expand function.
Virtual key expand function .