From ae884b01e24039a8f0dd5781ee93198064a8891d Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Fri, 4 Jan 2013 15:29:15 -0500 Subject: [PATCH] PEP8 fixes. Rename web_static -> web_backend --- lib/matplotlib/backends/backend_webagg.py | 63 +++++++++------- .../css/boilerplate.css | 0 .../{web_static => web_backend}/css/fbm.css | 0 .../{web_static => web_backend}/css/page.css | 0 .../{web_static => web_backend}/index.html | 68 ++++++++++-------- .../images/ui-bg_flat_0_aaaaaa_40x100.png | Bin .../images/ui-bg_flat_75_ffffff_40x100.png | Bin .../images/ui-bg_glass_55_fbf9ee_1x400.png | Bin .../images/ui-bg_glass_65_ffffff_1x400.png | Bin .../images/ui-bg_glass_75_dadada_1x400.png | Bin .../images/ui-bg_glass_75_e6e6e6_1x400.png | Bin .../images/ui-bg_glass_95_fef1ec_1x400.png | Bin .../ui-bg_highlight-soft_75_cccccc_1x100.png | Bin .../base/images/ui-icons_222222_256x240.png | Bin .../base/images/ui-icons_2e83ff_256x240.png | Bin .../base/images/ui-icons_454545_256x240.png | Bin .../base/images/ui-icons_888888_256x240.png | Bin .../base/images/ui-icons_cd0a0a_256x240.png | Bin .../jquery/css/themes/base/jquery-ui.min.css | 0 .../jquery/js/jquery-1.7.1.min.js | 0 .../jquery/js/jquery-ui.min.js | 0 .../jquery/js/jquery.autogrow.js | 0 .../{web_static => web_backend}/mpl.js | 0 23 files changed, 77 insertions(+), 54 deletions(-) rename lib/matplotlib/backends/{web_static => web_backend}/css/boilerplate.css (100%) rename lib/matplotlib/backends/{web_static => web_backend}/css/fbm.css (100%) rename lib/matplotlib/backends/{web_static => web_backend}/css/page.css (100%) rename lib/matplotlib/backends/{web_static => web_backend}/index.html (55%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-bg_flat_75_ffffff_40x100.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-bg_glass_65_ffffff_1x400.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-bg_glass_75_dadada_1x400.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-icons_222222_256x240.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-icons_2e83ff_256x240.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-icons_454545_256x240.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-icons_888888_256x240.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/images/ui-icons_cd0a0a_256x240.png (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/css/themes/base/jquery-ui.min.css (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/js/jquery-1.7.1.min.js (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/js/jquery-ui.min.js (100%) rename lib/matplotlib/backends/{web_static => web_backend}/jquery/js/jquery.autogrow.js (100%) rename lib/matplotlib/backends/{web_static => web_backend}/mpl.js (100%) diff --git a/lib/matplotlib/backends/backend_webagg.py b/lib/matplotlib/backends/backend_webagg.py index 32dc438da6d9..19702c0bc2da 100644 --- a/lib/matplotlib/backends/backend_webagg.py +++ b/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): diff --git a/lib/matplotlib/backends/web_static/css/boilerplate.css b/lib/matplotlib/backends/web_backend/css/boilerplate.css similarity index 100% rename from lib/matplotlib/backends/web_static/css/boilerplate.css rename to lib/matplotlib/backends/web_backend/css/boilerplate.css diff --git a/lib/matplotlib/backends/web_static/css/fbm.css b/lib/matplotlib/backends/web_backend/css/fbm.css similarity index 100% rename from lib/matplotlib/backends/web_static/css/fbm.css rename to lib/matplotlib/backends/web_backend/css/fbm.css diff --git a/lib/matplotlib/backends/web_static/css/page.css b/lib/matplotlib/backends/web_backend/css/page.css similarity index 100% rename from lib/matplotlib/backends/web_static/css/page.css rename to lib/matplotlib/backends/web_backend/css/page.css diff --git a/lib/matplotlib/backends/web_static/index.html b/lib/matplotlib/backends/web_backend/index.html similarity index 55% rename from lib/matplotlib/backends/web_static/index.html rename to lib/matplotlib/backends/web_backend/index.html index c4a34ce91297..dae3ad639ee1 100644 --- a/lib/matplotlib/backends/web_static/index.html +++ b/lib/matplotlib/backends/web_backend/index.html @@ -1,5 +1,5 @@ - + @@ -24,7 +24,8 @@ -
+
@@ -46,37 +47,44 @@
+ 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 %} - - {% else %} - - {% end %} + {% if name is None %} + + {% else %} + {% end %} - - - - + {% end %} + + + +
+
+
-
- -
diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_flat_75_ffffff_40x100.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_flat_75_ffffff_40x100.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_65_ffffff_1x400.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_65_ffffff_1x400.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_75_dadada_1x400.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_75_dadada_1x400.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_75_dadada_1x400.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_75_dadada_1x400.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_222222_256x240.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_222222_256x240.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_222222_256x240.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_222222_256x240.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_2e83ff_256x240.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_2e83ff_256x240.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_2e83ff_256x240.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_2e83ff_256x240.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_454545_256x240.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_454545_256x240.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_454545_256x240.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_454545_256x240.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_888888_256x240.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_888888_256x240.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_888888_256x240.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_888888_256x240.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_cd0a0a_256x240.png b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_cd0a0a_256x240.png similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/images/ui-icons_cd0a0a_256x240.png rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/images/ui-icons_cd0a0a_256x240.png diff --git a/lib/matplotlib/backends/web_static/jquery/css/themes/base/jquery-ui.min.css b/lib/matplotlib/backends/web_backend/jquery/css/themes/base/jquery-ui.min.css similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/css/themes/base/jquery-ui.min.css rename to lib/matplotlib/backends/web_backend/jquery/css/themes/base/jquery-ui.min.css diff --git a/lib/matplotlib/backends/web_static/jquery/js/jquery-1.7.1.min.js b/lib/matplotlib/backends/web_backend/jquery/js/jquery-1.7.1.min.js similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/js/jquery-1.7.1.min.js rename to lib/matplotlib/backends/web_backend/jquery/js/jquery-1.7.1.min.js diff --git a/lib/matplotlib/backends/web_static/jquery/js/jquery-ui.min.js b/lib/matplotlib/backends/web_backend/jquery/js/jquery-ui.min.js similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/js/jquery-ui.min.js rename to lib/matplotlib/backends/web_backend/jquery/js/jquery-ui.min.js diff --git a/lib/matplotlib/backends/web_static/jquery/js/jquery.autogrow.js b/lib/matplotlib/backends/web_backend/jquery/js/jquery.autogrow.js similarity index 100% rename from lib/matplotlib/backends/web_static/jquery/js/jquery.autogrow.js rename to lib/matplotlib/backends/web_backend/jquery/js/jquery.autogrow.js diff --git a/lib/matplotlib/backends/web_static/mpl.js b/lib/matplotlib/backends/web_backend/mpl.js similarity index 100% rename from lib/matplotlib/backends/web_static/mpl.js rename to lib/matplotlib/backends/web_backend/mpl.js