[PATCH 1/3] Add a help button to every Anaconda screen

Chris Lumens clumens at redhat.com
Fri Aug 15 16:52:38 UTC 2014


> +def get_help_path(help_file):
> +    """Return the full path for the given help file name,
> +    if the help file path does not exist a fallback path is returned.
> +    There are actually two possible fallback paths that might be returned:
> +    * first we try to return path to the main page of the installation guide
> +      (if it exists)
> +    * if we can't find the main page of the installation page, path to a
> +      "no help found" placeholder bundled with Anaconda is returned
> +
> +    :param str help_file: help file name
> +    :return str: full path to the help file requested or to a placeholder
> +    """
> +    # check if the screen has any helpFile defined
> +    if help_file:
> +        # check if the help file exists
> +        help_path = os.path.join(constants.HELP_FOLDER, help_file)
> +        if os.path.isfile(help_path):
> +            return help_path
> +        else:
> +            log.debug("the %s help file has been requested, but is not available", help_file)
> +
> +    # the screen did not have a helpFile defined or the defined help file
> +    # does not exist, so next try to check if we can find the main page
> +    # of the installation guide and use it instead
> +    help_path = os.path.join(constants.HELP_FOLDER, constants.HELP_MAIN_PAGE)
> +    if os.path.exists(help_path):
> +        return help_path
> +
> +    # looks like the installation guide is not available, so just return
> +    # a placeholder page that should always be available
> +    if flags.livecdInstall:
> +        return os.path.join(constants.HELP_FOLDER, constants.HELP_PLACEHOLDER_WITH_LINKS)
> +    else:
> +        return os.path.join(constants.HELP_FOLDER, constants.HELP_PLACEHOLDER)

How will translations be handled?

- Chris


More information about the anaconda-patches mailing list