Example #1
0
def image_help():
    embed = request.args.get('embed', '')

    http_server_url = external_url_for('index')
    server_url_idx = http_server_url.find(':') + 1
    server_url = http_server_url[server_url_idx:]

    help_image_attrs = ImageAttrs('test_images/cathedral.jpg')
    logo_image_attrs = ImageAttrs('test_images/quru110.png')
    logo_pad_image_attrs = ImageAttrs('test_images/quru470.png')

    available_formats = image_engine.get_image_formats()
    available_formats.sort()
    available_templates = image_engine.get_template_names()
    available_templates.sort()
    available_iccs = {}
    icc_types = image_engine.get_icc_profile_colorspaces()
    for cspace in icc_types:
        available_iccs[cspace] = image_engine.get_icc_profile_names(cspace)
        available_iccs[cspace].sort()

    default_settings_html = render_template(
        'inc_default_settings.html',
        formats=available_formats,
        templates=available_templates,
        iccs=available_iccs
    )

    response = make_response(render_template(
        'image_help.html',
        embed=embed,
        subs={
            '//images.example.com/': server_url,
            'cathedral.jpg': help_image_attrs.filename(with_path=False),
            'buildings': help_image_attrs.folder_path(),
            'quru.png': logo_image_attrs.filename(with_path=False),
            'quru-padded.png': logo_pad_image_attrs.filename(with_path=False),
            'logos': logo_image_attrs.folder_path(),
            'View this page from within QIS to see the'
            ' default image settings for your server.': default_settings_html
        }
    ))
    response.cache_control.public = True
    response.cache_control.max_age = 3600
    return response
Example #2
0
def _standard_help_page(template_file):
    """
    Calls and returns a render_template() with standard help page parameters.
    """
    http_server_url = external_url_for('index')
    server_url_idx = http_server_url.find(':') + 1
    server_url = http_server_url[server_url_idx:]

    response = make_response(render_template(
        template_file,
        subs={
            '//images.example.com/': server_url,
            'View this page from within QIS to see a demo.': 'A demo page is [available here](..).'
        }
    ))
    response.cache_control.public = True
    response.cache_control.max_age = 3600
    return response