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