Skip to content

Commit

Permalink
Merge pull request #113 from SciTools-incubator/web_load_errmsg
Browse files Browse the repository at this point in the history
Web load errmsg
  • Loading branch information
Malcolm Brooks authored Jul 5, 2018
2 parents 9432beb + bda3bcf commit 654ed98
Show file tree
Hide file tree
Showing 32 changed files with 173 additions and 13,188 deletions.
2 changes: 1 addition & 1 deletion ImageMetaTag/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'''

# see release_process for details on incrementing the version
__version__ = '0.7.3'
__version__ = '0.7.5'
__documentation__ = 'http://scitools-incubator.github.io/image-meta-tag/build/html/'

# list fo file formats which are valid for saving metadata to:
Expand Down
2 changes: 1 addition & 1 deletion ImageMetaTag/javascript/imt_dropdown.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ImageMetaTag dropdown menu scripting - vn0.7.3
// ImageMetaTag dropdown menu scripting - vn0.7.5
// ImageMetaTag is a python package built around a wrapper for savefig in
// matplotlib, which adds metadata tags to supported image file formats.
// See https://github.com/SciTools-incubator/image-meta-tag for details.
Expand Down
23 changes: 18 additions & 5 deletions ImageMetaTag/webpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def write_full_page(img_dict, filepath, title, page_filename=None, tab_s_name=No
show_singleton_selectors=True, optgroups=None,
url_type='int', only_show_rel_url=False, verbose=False,
style='horiz dropdowns', write_intmed_tmpfile=False,
description=None, keywords=None, css=None):
description=None, keywords=None, css=None, load_err_msg=None):
'''
Writes out an :class:`ImageMetaTag.ImageDict` as a webpage, to a given file location.
The files are created as temporary files and when complete they replace any files that
Expand Down Expand Up @@ -108,6 +108,10 @@ def write_full_page(img_dict, filepath, title, page_filename=None, tab_s_name=No
pako to inflate it (https://github.com/nodeca/pako)
* css - Optional CSS file used to style webpage. By default a small amount of css is \
written out in the page header.
* load_err_msg - additional message to show after 'Please wait while the page is loading'. \
default is None, but very large pages can crash with Internet Explorer so \
a message along the lines of this may be useful:
'If the page does not load correctly in Internet Explorer, please try using firefox or Chrome.'
Returns a list of files that the the created webpage is dependent upon
'''
Expand Down Expand Up @@ -325,7 +329,7 @@ def write_full_page(img_dict, filepath, title, page_filename=None, tab_s_name=No
write_js_placeholders(img_dict, file_obj=out_file, dict_depth=img_dict.dict_depth(),
style=style, level_names=level_names,
show_singleton_selectors=show_singleton_selectors,
animated_level=anim_level)
animated_level=anim_level, load_err_msg=load_err_msg)

# the body is done, so the postamble comes in:
postamble_endline = 'Page created with <a href="{}">ImageMetaTag {}</a>'
Expand Down Expand Up @@ -745,7 +749,7 @@ def compress_string(in_str):
def write_js_placeholders(img_dict, file_obj=None, dict_depth=None, selector_prefix=None,
style='horiz dropdowns', level_names=False,
show_singleton_selectors=True,
animated_level=None):
animated_level=None, load_err_msg=None):
'''
Writes the placeholders into the page body, for the javascript to manipulate
Expand All @@ -760,6 +764,10 @@ def write_js_placeholders(img_dict, file_obj=None, dict_depth=None, selector_pre
* level_names - if supplied, this need to be a list of full names, for the selectors, of \
length dict_depth.
* animated_level - if supplied, as a string, this will be used to label the animator buttons.
* load_err_msg - additional message to show after 'Please wait while the page is loading'. \
default is None, but very large pages can crash with Internet Explorer so \
a message along the lines of this may be useful:
'If the page does not load correctly in Internet Explorer, please try using firefox or Chrome.'
'''

if not show_singleton_selectors:
Expand Down Expand Up @@ -844,8 +852,13 @@ def write_js_placeholders(img_dict, file_obj=None, dict_depth=None, selector_pre
'''.format(anim_label))

# now add somewhere for the image to go:
file_obj.write(''' <div id="the_image">Please wait while the page is loading</div>
<div id="the_url">....</div>''')
if load_err_msg is None:
img_div = ' <div id="the_image">Please wait while the page is loading</div>'
file_obj.write(img_div)
else:
img_div = ' <div id="the_image">Please wait while the page is loading.<br>{}</div>'
file_obj.write(img_div.format(load_err_msg))
file_obj.write(' <div id="the_url">....</div>')
# and finish off the placeholders:
file_obj.write('''
</font>
Expand Down
Binary file modified docs/build/doctrees/db.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/simple.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/webpage.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: d14e19c66f4efecdcc9cac0ed15055e7
config: 2af4d4202d15de90f1a1df833f6c38d4
tags: 645f666f9bcd5a90fca523b33c5a78b7
10 changes: 5 additions & 5 deletions docs/build/html/ImageDict.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>ImageMetaTag.ImageDict &mdash; ImageMetaTag 0.7.3 documentation</title>
<title>ImageMetaTag.ImageDict &mdash; ImageMetaTag 0.7.5 documentation</title>

<link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.7.3',
VERSION: '0.7.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -23,7 +23,7 @@
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="ImageMetaTag 0.7.3 documentation" href="index.html" />
<link rel="top" title="ImageMetaTag 0.7.5 documentation" href="index.html" />
<link rel="next" title="ImageMetaTag.webpage" href="webpage.html" />
<link rel="prev" title="ImageMetaTag.db" href="db.html" />
</head>
Expand All @@ -43,7 +43,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="db.html" title="ImageMetaTag.db"
accesskey="P">previous</a> |</li>
<li><a href="index.html">ImageMetaTag 0.7.3 documentation</a> &raquo;</li>
<li><a href="index.html">ImageMetaTag 0.7.5 documentation</a> &raquo;</li>
</ul>
</div>
<div class="sphinxsidebar">
Expand Down Expand Up @@ -408,7 +408,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="db.html" title="ImageMetaTag.db"
>previous</a> |</li>
<li><a href="index.html">ImageMetaTag 0.7.3 documentation</a> &raquo;</li>
<li><a href="index.html">ImageMetaTag 0.7.5 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer">
Expand Down
12 changes: 6 additions & 6 deletions docs/build/html/_modules/ImageMetaTag.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>ImageMetaTag &mdash; ImageMetaTag 0.7.3 documentation</title>
<title>ImageMetaTag &mdash; ImageMetaTag 0.7.5 documentation</title>

<link rel="stylesheet" href="../_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.7.3',
VERSION: '0.7.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -23,7 +23,7 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="ImageMetaTag 0.7.3 documentation" href="../index.html" />
<link rel="top" title="ImageMetaTag 0.7.5 documentation" href="../index.html" />
<link rel="up" title="Module code" href="index.html" />
</head>
<body>
Expand All @@ -36,7 +36,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">ImageMetaTag 0.7.3 documentation</a> &raquo;</li>
<li><a href="../index.html">ImageMetaTag 0.7.5 documentation</a> &raquo;</li>
<li><a href="index.html" accesskey="U">Module code</a> &raquo;</li>
</ul>
</div>
Expand Down Expand Up @@ -90,7 +90,7 @@ <h1>Source code for ImageMetaTag</h1><div class="highlight"><pre>
<span class="sd">&#39;&#39;&#39;</span>

<span class="c"># see release_process for details on incrementing the version</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s">&#39;0.7.3&#39;</span>
<span class="n">__version__</span> <span class="o">=</span> <span class="s">&#39;0.7.5&#39;</span>
<span class="n">__documentation__</span> <span class="o">=</span> <span class="s">&#39;http://scitools-incubator.github.io/image-meta-tag/build/html/&#39;</span>

<span class="c"># list fo file formats which are valid for saving metadata to:</span>
Expand Down Expand Up @@ -131,7 +131,7 @@ <h3>Navigation</h3>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">ImageMetaTag 0.7.3 documentation</a> &raquo;</li>
<li><a href="../index.html">ImageMetaTag 0.7.5 documentation</a> &raquo;</li>
<li><a href="index.html" >Module code</a> &raquo;</li>
</ul>
</div>
Expand Down
Loading

0 comments on commit 654ed98

Please sign in to comment.