##// END OF EJS Templates
Merge pull request #7004 from minrk/jupyter-logo...
Thomas Kluyver -
r19029:b997c914 merge
parent child Browse files
Show More
1 NO CONTENT: new file 100644, binary diff hidden
@@ -1,132 +1,132
1 1 #-----------------------------------------------------------------------------
2 2 # Copyright (C) 2010-2011 The IPython Development Team.
3 3 #
4 4 # Distributed under the terms of the BSD License.
5 5 #
6 6 # The full license is in the file COPYING.txt, distributed with this software.
7 7 #-----------------------------------------------------------------------------
8 8 import os
9 9
10 10 import nose.tools as nt
11 11
12 12 from IPython.core import display
13 13 from IPython.core.getipython import get_ipython
14 14 from IPython.utils import path as ipath
15 15
16 16 import IPython.testing.decorators as dec
17 17
18 18 def test_image_size():
19 19 """Simple test for display.Image(args, width=x,height=y)"""
20 20 thisurl = 'http://www.google.fr/images/srpr/logo3w.png'
21 21 img = display.Image(url=thisurl, width=200, height=200)
22 22 nt.assert_equal(u'<img src="%s" width="200" height="200"/>' % (thisurl), img._repr_html_())
23 23 img = display.Image(url=thisurl, width=200)
24 24 nt.assert_equal(u'<img src="%s" width="200"/>' % (thisurl), img._repr_html_())
25 25 img = display.Image(url=thisurl)
26 26 nt.assert_equal(u'<img src="%s"/>' % (thisurl), img._repr_html_())
27 27
28 28 def test_retina_png():
29 29 here = os.path.dirname(__file__)
30 30 img = display.Image(os.path.join(here, "2x2.png"), retina=True)
31 31 nt.assert_equal(img.height, 1)
32 32 nt.assert_equal(img.width, 1)
33 33 data, md = img._repr_png_()
34 34 nt.assert_equal(md['width'], 1)
35 35 nt.assert_equal(md['height'], 1)
36 36
37 37 def test_retina_jpeg():
38 38 here = os.path.dirname(__file__)
39 39 img = display.Image(os.path.join(here, "2x2.jpg"), retina=True)
40 40 nt.assert_equal(img.height, 1)
41 41 nt.assert_equal(img.width, 1)
42 42 data, md = img._repr_jpeg_()
43 43 nt.assert_equal(md['width'], 1)
44 44 nt.assert_equal(md['height'], 1)
45 45
46 46 def test_image_filename_defaults():
47 47 '''test format constraint, and validity of jpeg and png'''
48 48 tpath = ipath.get_ipython_package_dir()
49 49 nt.assert_raises(ValueError, display.Image, filename=os.path.join(tpath, 'testing/tests/badformat.gif'),
50 50 embed=True)
51 51 nt.assert_raises(ValueError, display.Image)
52 52 nt.assert_raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True)
53 53 from IPython.html import DEFAULT_STATIC_FILES_PATH
54 54 # check boths paths to allow packages to test at build and install time
55 imgfile = os.path.join(tpath, 'html/static/base/images/ipynblogo.png')
55 imgfile = os.path.join(tpath, 'html/static/base/images/logo.png')
56 56 if not os.path.exists(imgfile):
57 imgfile = os.path.join(DEFAULT_STATIC_FILES_PATH, 'base/images/ipynblogo.png')
57 imgfile = os.path.join(DEFAULT_STATIC_FILES_PATH, 'base/images/logo.png')
58 58 img = display.Image(filename=imgfile)
59 59 nt.assert_equal('png', img.format)
60 60 nt.assert_is_not_none(img._repr_png_())
61 61 img = display.Image(filename=os.path.join(tpath, 'testing/tests/logo.jpg'), embed=False)
62 62 nt.assert_equal('jpeg', img.format)
63 63 nt.assert_is_none(img._repr_jpeg_())
64 64
65 65 def _get_inline_config():
66 66 from IPython.kernel.zmq.pylab.config import InlineBackend
67 67 return InlineBackend.instance()
68 68
69 69 @dec.skip_without('matplotlib')
70 70 def test_set_matplotlib_close():
71 71 cfg = _get_inline_config()
72 72 cfg.close_figures = False
73 73 display.set_matplotlib_close()
74 74 assert cfg.close_figures
75 75 display.set_matplotlib_close(False)
76 76 assert not cfg.close_figures
77 77
78 78 _fmt_mime_map = {
79 79 'png': 'image/png',
80 80 'jpeg': 'image/jpeg',
81 81 'pdf': 'application/pdf',
82 82 'retina': 'image/png',
83 83 'svg': 'image/svg+xml',
84 84 }
85 85
86 86 @dec.skip_without('matplotlib')
87 87 def test_set_matplotlib_formats():
88 88 from matplotlib.figure import Figure
89 89 formatters = get_ipython().display_formatter.formatters
90 90 for formats in [
91 91 ('png',),
92 92 ('pdf', 'svg'),
93 93 ('jpeg', 'retina', 'png'),
94 94 (),
95 95 ]:
96 96 active_mimes = {_fmt_mime_map[fmt] for fmt in formats}
97 97 display.set_matplotlib_formats(*formats)
98 98 for mime, f in formatters.items():
99 99 if mime in active_mimes:
100 100 nt.assert_in(Figure, f)
101 101 else:
102 102 nt.assert_not_in(Figure, f)
103 103
104 104 @dec.skip_without('matplotlib')
105 105 def test_set_matplotlib_formats_kwargs():
106 106 from matplotlib.figure import Figure
107 107 ip = get_ipython()
108 108 cfg = _get_inline_config()
109 109 cfg.print_figure_kwargs.update(dict(foo='bar'))
110 110 kwargs = dict(quality=10)
111 111 display.set_matplotlib_formats('png', **kwargs)
112 112 formatter = ip.display_formatter.formatters['image/png']
113 113 f = formatter.lookup_by_type(Figure)
114 114 cell = f.__closure__[0].cell_contents
115 115 expected = kwargs
116 116 expected.update(cfg.print_figure_kwargs)
117 117 nt.assert_equal(cell, expected)
118 118
119 119 def test_displayobject_repr():
120 120 h = display.HTML('<br />')
121 121 nt.assert_equal(repr(h), '<IPython.core.display.HTML object>')
122 122 h._show_mem_addr = True
123 123 nt.assert_equal(repr(h), object.__repr__(h))
124 124 h._show_mem_addr = False
125 125 nt.assert_equal(repr(h), '<IPython.core.display.HTML object>')
126 126
127 127 j = display.Javascript('')
128 128 nt.assert_equal(repr(j), '<IPython.core.display.Javascript object>')
129 129 j._show_mem_addr = True
130 130 nt.assert_equal(repr(j), object.__repr__(j))
131 131 j._show_mem_addr = False
132 132 nt.assert_equal(repr(j), '<IPython.core.display.Javascript object>')
1 NO CONTENT: modified file, binary diff hidden
@@ -1,104 +1,104
1 1 <!DOCTYPE HTML>
2 2 <html>
3 3
4 4 <head>
5 5 <meta charset="utf-8">
6 6
7 7 <title>{% block title %}IPython Notebook{% endblock %}</title>
8 8 <link rel="shortcut icon" type="image/x-icon" href="{{static_url("base/images/favicon.ico") }}">
9 9 <meta http-equiv="X-UA-Compatible" content="chrome=1">
10 10 <link rel="stylesheet" href="{{static_url("components/jquery-ui/themes/smoothness/jquery-ui.min.css") }}" type="text/css" />
11 11 <meta name="viewport" content="width=device-width, initial-scale=1.0">
12 12
13 13 {% block stylesheet %}
14 14 <link rel="stylesheet" href="{{ static_url("style/style.min.css") }}" type="text/css"/>
15 15 {% endblock %}
16 16 <link rel="stylesheet" href="{{ static_url("custom/custom.css") }}" type="text/css" />
17 17 <script src="{{static_url("components/es6-promise/promise.min.js")}}" type="text/javascript" charset="utf-8"></script>
18 18 <script src="{{static_url("components/requirejs/require.js") }}" type="text/javascript" charset="utf-8"></script>
19 19 <script>
20 20 require.config({
21 21 baseUrl: '{{static_url("", include_version=False)}}',
22 22 paths: {
23 23 nbextensions : '{{ base_url }}nbextensions',
24 24 underscore : 'components/underscore/underscore-min',
25 25 backbone : 'components/backbone/backbone-min',
26 26 jquery: 'components/jquery/jquery.min',
27 27 bootstrap: 'components/bootstrap/js/bootstrap.min',
28 28 bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
29 29 jqueryui: 'components/jquery-ui/ui/minified/jquery-ui.min',
30 30 moment: 'components/moment/moment',
31 31 codemirror: 'components/codemirror',
32 32 termjs: 'components/term.js/src/term',
33 33 contents: '{{ contents_js_source }}',
34 34 },
35 35 shim: {
36 36 underscore: {
37 37 exports: '_'
38 38 },
39 39 backbone: {
40 40 deps: ["underscore", "jquery"],
41 41 exports: "Backbone"
42 42 },
43 43 bootstrap: {
44 44 deps: ["jquery"],
45 45 exports: "bootstrap"
46 46 },
47 47 bootstraptour: {
48 48 deps: ["bootstrap"],
49 49 exports: "Tour"
50 50 },
51 51 jqueryui: {
52 52 deps: ["jquery"],
53 53 exports: "$"
54 54 }
55 55 }
56 56 });
57 57 </script>
58 58
59 59 {% block meta %}
60 60 {% endblock %}
61 61
62 62 </head>
63 63
64 64 <body {% block params %}{% endblock %}>
65 65
66 66 <noscript>
67 67 <div id='noscript'>
68 68 IPython Notebook requires JavaScript.<br>
69 69 Please enable it to proceed.
70 70 </div>
71 71 </noscript>
72 72
73 73 <div id="header" class="navbar navbar-static-top">
74 74 <div class="container">
75 <div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{base_url}}tree" alt='dashboard'>{% block logo %}<img src='{{static_url("base/images/ipynblogo.png") }}' alt='IPython Notebook'/>{% endblock %}</a></div>
75 <div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="{{base_url}}tree" alt='dashboard'>{% block logo %}<img src='{{static_url("base/images/logo.png") }}' alt='Jupyter Notebook'/>{% endblock %}</a></div>
76 76
77 77 {% block login_widget %}
78 78
79 79 <span id="login_widget">
80 80 {% if logged_in %}
81 81 <button id="logout">Logout</button>
82 82 {% elif login_available and not logged_in %}
83 83 <button id="login">Login</button>
84 84 {% endif %}
85 85 </span>
86 86
87 87 {% endblock %}
88 88
89 89 {% block header %}
90 90 {% endblock %}
91 91 </div>
92 92 </div>
93 93
94 94 <div id="site">
95 95 {% block site %}
96 96 {% endblock %}
97 97 </div>
98 98
99 99 {% block script %}
100 100 {% endblock %}
101 101
102 102 </body>
103 103
104 104 </html>
1 NO CONTENT: file was removed, binary diff hidden
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now