Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

PEP8 fixes. Rename web_static -> web_backend

  • Loading branch information...
commit ae884b01e24039a8f0dd5781ee93198064a8891d 1 parent c5479c2
@mdboom authored
Showing with 77 additions and 54 deletions.
  1. +39 −24 lib/matplotlib/backends/backend_webagg.py
  2. 0  lib/matplotlib/backends/{web_static → web_backend}/css/boilerplate.css
  3. 0  lib/matplotlib/backends/{web_static → web_backend}/css/fbm.css
  4. 0  lib/matplotlib/backends/{web_static → web_backend}/css/page.css
  5. +38 −30 lib/matplotlib/backends/{web_static → web_backend}/index.html
  6. 0  ...otlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  7. 0  ...tlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  8. 0  ...tlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  9. 0  ...tlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  10. 0  ...tlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  11. 0  ...tlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  12. 0  ...tlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  13. 0  ...ends/{web_static → web_backend}/jquery/css/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  14. 0  ...tplotlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-icons_222222_256x240.png
  15. 0  ...tplotlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-icons_2e83ff_256x240.png
  16. 0  ...tplotlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-icons_454545_256x240.png
  17. 0  ...tplotlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-icons_888888_256x240.png
  18. 0  ...tplotlib/backends/{web_static → web_backend}/jquery/css/themes/base/images/ui-icons_cd0a0a_256x240.png
  19. 0  lib/matplotlib/backends/{web_static → web_backend}/jquery/css/themes/base/jquery-ui.min.css
  20. 0  lib/matplotlib/backends/{web_static → web_backend}/jquery/js/jquery-1.7.1.min.js
  21. 0  lib/matplotlib/backends/{web_static → web_backend}/jquery/js/jquery-ui.min.js
  22. 0  lib/matplotlib/backends/{web_static → web_backend}/jquery/js/jquery.autogrow.js
  23. 0  lib/matplotlib/backends/{web_static → web_backend}/mpl.js
View
63 lib/matplotlib/backends/backend_webagg.py
@@ -46,7 +46,7 @@ def mainloop(self):
WebAggApplication.initialize()
for manager in Gcf.get_all_fig_managers():
url = "http://127.0.0.1:{0}/{1}/".format(
- WebAggApplication.port, manager.num)
+ WebAggApplication.port, manager.num)
if rcParams['webagg.open_in_browser']:
import webbrowser
webbrowser.open(url)
@@ -191,8 +191,8 @@ def get_diff_image(self):
self._png_buffer)
# Swap the renderer frames
- self._renderer, self._last_renderer = \
- self._last_renderer, self._renderer
+ self._renderer, self._last_renderer = (
+ self._last_renderer, self._renderer)
self._force_full = False
self._png_is_old = False
return self._png_buffer.getvalue()
@@ -208,8 +208,10 @@ def get_renderer(self):
need_new_renderer = (self._lastKey != key)
if need_new_renderer:
- self._renderer = backend_agg.RendererAgg(w, h, self.figure.dpi)
- self._last_renderer = backend_agg.RendererAgg(w, h, self.figure.dpi)
+ self._renderer = backend_agg.RendererAgg(
+ w, h, self.figure.dpi)
+ self._last_renderer = backend_agg.RendererAgg(
+ w, h, self.figure.dpi)
self._lastKey = key
return self._renderer
@@ -261,11 +263,13 @@ def new_timer(self, *args, **kwargs):
def start_event_loop(self, timeout):
backend_bases.FigureCanvasBase.start_event_loop_default(
self, timeout)
- start_event_loop.__doc__ = backend_bases.FigureCanvasBase.start_event_loop_default.__doc__
+ start_event_loop.__doc__ = \
+ backend_bases.FigureCanvasBase.start_event_loop_default.__doc__
def stop_event_loop(self):
backend_bases.FigureCanvasBase.stop_event_loop_default(self)
- stop_event_loop.__doc__ = backend_bases.FigureCanvasBase.stop_event_loop_default.__doc__
+ stop_event_loop.__doc__ = \
+ backend_bases.FigureCanvasBase.stop_event_loop_default.__doc__
class FigureManagerWebAgg(backend_bases.FigureManagerBase):
@@ -304,18 +308,22 @@ def resize(self, w, h):
class NavigationToolbar2WebAgg(backend_bases.NavigationToolbar2):
toolitems = list(backend_bases.NavigationToolbar2.toolitems[:6]) + [
('Download', 'Download plot', 'filesave', 'download')
- ]
+ ]
def _init_toolbar(self):
- jqueryui_icons = ['ui-icon ui-icon-home',
+ jqueryui_icons = [
+ 'ui-icon ui-icon-home',
'ui-icon ui-icon-circle-arrow-w',
- 'ui-icon ui-icon-circle-arrow-e', None,
+ 'ui-icon ui-icon-circle-arrow-e',
+ None,
'ui-icon ui-icon-arrow-4',
'ui-icon ui-icon-search',
- 'ui-icon ui-icon-disk']
+ 'ui-icon ui-icon-disk'
+ ]
for index, item in enumerate(self.toolitems):
if item[0] is not None:
- self.toolitems[index]=(item[0],item[1],jqueryui_icons[index],item[3])
+ self.toolitems[index] = (
+ item[0], item[1], jqueryui_icons[index], item[3])
self.message = ''
self.cursor = 0
@@ -361,7 +369,7 @@ class IndexPage(tornado.web.RequestHandler):
def get(self, fignum):
with open(os.path.join(
os.path.dirname(__file__),
- 'web_static', 'index.html')) as fd:
+ 'web_backend', 'index.html')) as fd:
tpl = fd.read()
fignum = int(fignum)
@@ -387,7 +395,7 @@ def get(self, fignum, format):
'jpeg': 'image/jpeg',
'tif': 'image/tiff',
'emf': 'application/emf'
- }
+ }
self.set_header('Content-Type', mimetypes.get(format, 'binary'))
@@ -438,25 +446,32 @@ def send_image(self):
def __init__(self):
super(WebAggApplication, self).__init__([
# Static files for the CSS and JS
- (r'/static/(.*)', tornado.web.StaticFileHandler,
+ (r'/static/(.*)',
+ tornado.web.StaticFileHandler,
{'path':
- os.path.join(os.path.dirname(__file__), 'web_static')}),
+ os.path.join(os.path.dirname(__file__), 'web_backend')}),
# Static images for toolbar buttons
- (r'/images/(.*)', tornado.web.StaticFileHandler,
+ (r'/images/(.*)',
+ tornado.web.StaticFileHandler,
{'path':
os.path.join(os.path.dirname(__file__), '../mpl-data/images')}),
- (r'/static/jquery/css/themes/base/(.*)', tornado.web.StaticFileHandler,
+ (r'/static/jquery/css/themes/base/(.*)',
+ tornado.web.StaticFileHandler,
{'path':
- os.path.join(os.path.dirname(__file__), 'web_static/jquery/css/themes/base')}),
- (r'/static/jquery/css/themes/base/images/(.*)', tornado.web.StaticFileHandler,
+ os.path.join(os.path.dirname(__file__),
+ 'web_backend/jquery/css/themes/base')}),
+ (r'/static/jquery/css/themes/base/images/(.*)',
+ tornado.web.StaticFileHandler,
{'path':
- os.path.join(os.path.dirname(__file__), 'web_static/jquery/css/themes/base/images')}),
+ os.path.join(os.path.dirname(__file__),
+ 'web_backend/jquery/css/themes/base/images')}),
(r'/static/jquery/js/(.*)', tornado.web.StaticFileHandler,
{'path':
- os.path.join(os.path.dirname(__file__), 'web_static/jquery/js')}),
+ os.path.join(os.path.dirname(__file__),
+ 'web_backend/jquery/js')}),
(r'/static/css/(.*)', tornado.web.StaticFileHandler,
{'path':
- os.path.join(os.path.dirname(__file__), 'web_static/css')}),
+ os.path.join(os.path.dirname(__file__), 'web_backend/css')}),
# An MPL favicon
(r'/favicon.ico', self.FavIcon),
# The page that contains all of the pieces
@@ -466,7 +481,7 @@ def __init__(self):
(r'/([0-9]+)/ws', self.WebSocket),
# Handles the downloading (i.e., saving) of static images
(r'/([0-9]+)/download.([a-z]+)', self.Download)
- ])
+ ])
@classmethod
def initialize(cls):
View
0  ...b/backends/web_static/css/boilerplate.css → .../backends/web_backend/css/boilerplate.css
File renamed without changes
View
0  ...atplotlib/backends/web_static/css/fbm.css → ...tplotlib/backends/web_backend/css/fbm.css
File renamed without changes
View
0  ...tplotlib/backends/web_static/css/page.css → ...plotlib/backends/web_backend/css/page.css
File renamed without changes
View
68 ...matplotlib/backends/web_static/index.html → ...atplotlib/backends/web_backend/index.html
@@ -1,5 +1,5 @@
<html>
- <head>
+ <head>
<link rel="stylesheet" href="/static/css/page.css" type="text/css">
<link rel="stylesheet" href="/static/css/boilerplate.css" type="text/css" />
<link rel="stylesheet" href="/static/css/fbm.css" type="text/css" />
@@ -24,7 +24,8 @@
<body
onkeydown="key_event(event, 'key_press')"
onkeyup="key_event(event, 'key_release')">
- <div id="mpl-div" style="margin-left: auto ; margin-right: auto ; width: 800px;">
+ <div id="mpl-div"
+ style="margin-left: auto ; margin-right: auto ; width: 800px;">
<div id="mpl-warnings" class="mpl-warnings">
</div>
@@ -46,37 +47,44 @@
</div>
<div id="toolbar" class="ui-widget ui-widget-content"
- style="border-top-style: none; border-left-style: none; border-right-style: none; border-bottom-style: none;">
+ style="border-top-style: none; border-left-style: none;
+ border-right-style: none; border-bottom-style: none;">
{% for name, tooltip, image, method in toolitems %}
- {% if name is None %}
- <span style='width: 0.1em'></span>
- {% else %}
- <button id="{{ name }}"
- onclick="toolbar_button_onclick('{{ method }}');"
- role="button"
- aria-disabled="false"
- class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only">
- <span class="ui-button-icon-primary ui-icon {{ image }} ui-corner-all"></span>
- <span class="ui-button-text">{{ tooltip }}</span>
- </button>
- {% end %}
+ {% if name is None %}
+ <span style='width: 0.1em'></span>
+ {% else %}
+ <button id="{{ name }}"
+ onclick="toolbar_button_onclick('{{ method }}');"
+ role="button"
+ aria-disabled="false"
+ class="ui-button ui-widget ui-state-default ui-corner-all
+ ui-button-icon-only">
+ <span
+ class="ui-button-icon-primary ui-icon {{ image }}
+ ui-corner-all">
+ </span>
+ <span class="ui-button-text">
+ {{ tooltip }}
+ </span>
+ </button>
{% end %}
- <span>
- <select id="mpl-format" class="mpl-toolbar-option ui-widget ui-widget-content" style="margin-top: 0px;">
- {% for filetype, extensions in sorted(canvas.get_supported_filetypes_grouped().items()) %}
- <option value="{{ extensions[0] }}"
- {% if extensions[0] == canvas.get_default_filetype() %}
- selected
- {% end %}
- >{{filetype}} ({{", ".join(extensions)}})</option>
- {% end %}
- </select>
- </span>
-
+ {% end %}
+ <span>
+ <select id="mpl-format" class="mpl-toolbar-option ui-widget ui-widget-content" style="margin-top: 0px;">
+ {% for filetype, extensions in sorted(canvas.get_supported_filetypes_grouped().items()) %}
+ <option value="{{ extensions[0] }}"
+ {% if extensions[0] == canvas.get_default_filetype() %}
+ selected
+ {% end %}
+ >{{filetype}} ({{", ".join(extensions)}})
+ </option>
+ {% end %}
+ </select>
+ </span>
+ </div>
+ <div>
+ <span id="mpl-message" class="mpl-message"/>
</div>
- <div>
- <span id="mpl-message" class="mpl-message"/>
- </div>
</div>
</body>
</html>
View
0  ...ase/images/ui-bg_flat_0_aaaaaa_40x100.png → ...ase/images/ui-bg_flat_0_aaaaaa_40x100.png
File renamed without changes
View
0  ...se/images/ui-bg_flat_75_ffffff_40x100.png → ...se/images/ui-bg_flat_75_ffffff_40x100.png
File renamed without changes
View
0  ...se/images/ui-bg_glass_55_fbf9ee_1x400.png → ...se/images/ui-bg_glass_55_fbf9ee_1x400.png
File renamed without changes
View
0  ...se/images/ui-bg_glass_65_ffffff_1x400.png → ...se/images/ui-bg_glass_65_ffffff_1x400.png
File renamed without changes
View
0  ...se/images/ui-bg_glass_75_dadada_1x400.png → ...se/images/ui-bg_glass_75_dadada_1x400.png
File renamed without changes
View
0  ...se/images/ui-bg_glass_75_e6e6e6_1x400.png → ...se/images/ui-bg_glass_75_e6e6e6_1x400.png
File renamed without changes
View
0  ...se/images/ui-bg_glass_95_fef1ec_1x400.png → ...se/images/ui-bg_glass_95_fef1ec_1x400.png
File renamed without changes
View
0  .../ui-bg_highlight-soft_75_cccccc_1x100.png → .../ui-bg_highlight-soft_75_cccccc_1x100.png
File renamed without changes
View
0  ...s/base/images/ui-icons_222222_256x240.png → ...s/base/images/ui-icons_222222_256x240.png
File renamed without changes
View
0  ...s/base/images/ui-icons_2e83ff_256x240.png → ...s/base/images/ui-icons_2e83ff_256x240.png
File renamed without changes
View
0  ...s/base/images/ui-icons_454545_256x240.png → ...s/base/images/ui-icons_454545_256x240.png
File renamed without changes
View
0  ...s/base/images/ui-icons_888888_256x240.png → ...s/base/images/ui-icons_888888_256x240.png
File renamed without changes
View
0  ...s/base/images/ui-icons_cd0a0a_256x240.png → ...s/base/images/ui-icons_cd0a0a_256x240.png
File renamed without changes
View
0  .../jquery/css/themes/base/jquery-ui.min.css → .../jquery/css/themes/base/jquery-ui.min.css
File renamed without changes
View
0  .../web_static/jquery/js/jquery-1.7.1.min.js → ...web_backend/jquery/js/jquery-1.7.1.min.js
File renamed without changes
View
0  ...nds/web_static/jquery/js/jquery-ui.min.js → ...ds/web_backend/jquery/js/jquery-ui.min.js
File renamed without changes
View
0  ...s/web_static/jquery/js/jquery.autogrow.js → .../web_backend/jquery/js/jquery.autogrow.js
File renamed without changes
View
0  lib/matplotlib/backends/web_static/mpl.js → lib/matplotlib/backends/web_backend/mpl.js
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.