(string, setting_info)
return True, ""
Checks if the regbradient expression is valid.

    :param str string: The string to validate.
    :param dict setting_info: the settings info from the mouse profile.
    :rtype: (bool, str)
Checks if the regbradient expression is valid.
Checks if the regbradient expression is valid .
def is_buttons(string, setting_info):
    """Checks if the regbradient expression is valid.

    :param str string: The string to validate.
    :param dict setting_info: the settings info from the mouse profile.
    :rtype: (bool, str)
    """
    available_buttons = {k.lower(): v for k, v in setting_info["buttons"].items()}

    try:
        buttons_dict = parse_param_string(string)
    except ValueError as e:
        return False, str(e)

    if "buttons" not in buttons_dict:
        return (
            False,
            "Buttons expression must looks like buttons(<BUTTON>=<VALUE>; <BUTTON_N>=<VALUE_N>)",
        )

    for key, value in [
        (k.lower(), v.lower()) for k, v in buttons_dict["buttons"].items()
    ]:
        if key == "layout":
            if value not in LAYOUTS:
                return False, "Unknown layout '%s'" % value
        else:
            if key not in available_buttons:
                return False, "This mouse have no button named '%s'" % key

    return True, ""
def is_buttons ( string , setting_info ) : available_buttons = { k . lower ( ) : v for k , v in setting_info [ "buttons" ] . items ( ) } try : buttons_dict = parse_param_string ( string ) except ValueError as e : return False , str ( e ) if "buttons" not in buttons_dict : return ( False , "Buttons expression must looks like buttons(<BUTTON>=<VALUE>; <BUTTON_N>=<VALUE_N>)" , ) for key , value in [ ( k . lower ( ) , v . lower ( ) ) for k , v in buttons_dict [ "buttons" ] . items ( ) ] : if key == "layout" : if value not in LAYOUTS : return False , "Unknown layout '%s'" % value else : if key not in available_buttons : return False , "This mouse have no button named '%s'" % key return True , ""