@@ -46,7 +46,7 @@ def mainloop(self):
4646 WebAggApplication .initialize ()
4747 for manager in Gcf .get_all_fig_managers ():
4848 url = "http://127.0.0.1:{0}/{1}/" .format (
49- WebAggApplication .port , manager .num )
49+ WebAggApplication .port , manager .num )
5050 if rcParams ['webagg.open_in_browser' ]:
5151 import webbrowser
5252 webbrowser .open (url )
@@ -191,8 +191,8 @@ def get_diff_image(self):
191191 self ._png_buffer )
192192
193193 # Swap the renderer frames
194- self ._renderer , self ._last_renderer = \
195- self ._last_renderer , self ._renderer
194+ self ._renderer , self ._last_renderer = (
195+ self ._last_renderer , self ._renderer )
196196 self ._force_full = False
197197 self ._png_is_old = False
198198 return self ._png_buffer .getvalue ()
@@ -208,8 +208,10 @@ def get_renderer(self):
208208 need_new_renderer = (self ._lastKey != key )
209209
210210 if need_new_renderer :
211- self ._renderer = backend_agg .RendererAgg (w , h , self .figure .dpi )
212- self ._last_renderer = backend_agg .RendererAgg (w , h , self .figure .dpi )
211+ self ._renderer = backend_agg .RendererAgg (
212+ w , h , self .figure .dpi )
213+ self ._last_renderer = backend_agg .RendererAgg (
214+ w , h , self .figure .dpi )
213215 self ._lastKey = key
214216
215217 return self ._renderer
@@ -261,11 +263,13 @@ def new_timer(self, *args, **kwargs):
261263 def start_event_loop (self , timeout ):
262264 backend_bases .FigureCanvasBase .start_event_loop_default (
263265 self , timeout )
264- start_event_loop .__doc__ = backend_bases .FigureCanvasBase .start_event_loop_default .__doc__
266+ start_event_loop .__doc__ = \
267+ backend_bases .FigureCanvasBase .start_event_loop_default .__doc__
265268
266269 def stop_event_loop (self ):
267270 backend_bases .FigureCanvasBase .stop_event_loop_default (self )
268- stop_event_loop .__doc__ = backend_bases .FigureCanvasBase .stop_event_loop_default .__doc__
271+ stop_event_loop .__doc__ = \
272+ backend_bases .FigureCanvasBase .stop_event_loop_default .__doc__
269273
270274
271275class FigureManagerWebAgg (backend_bases .FigureManagerBase ):
@@ -304,18 +308,22 @@ def resize(self, w, h):
304308class NavigationToolbar2WebAgg (backend_bases .NavigationToolbar2 ):
305309 toolitems = list (backend_bases .NavigationToolbar2 .toolitems [:6 ]) + [
306310 ('Download' , 'Download plot' , 'filesave' , 'download' )
307- ]
311+ ]
308312
309313 def _init_toolbar (self ):
310- jqueryui_icons = ['ui-icon ui-icon-home' ,
314+ jqueryui_icons = [
315+ 'ui-icon ui-icon-home' ,
311316 'ui-icon ui-icon-circle-arrow-w' ,
312- 'ui-icon ui-icon-circle-arrow-e' , None ,
317+ 'ui-icon ui-icon-circle-arrow-e' ,
318+ None ,
313319 'ui-icon ui-icon-arrow-4' ,
314320 'ui-icon ui-icon-search' ,
315- 'ui-icon ui-icon-disk' ]
321+ 'ui-icon ui-icon-disk'
322+ ]
316323 for index , item in enumerate (self .toolitems ):
317324 if item [0 ] is not None :
318- self .toolitems [index ]= (item [0 ],item [1 ],jqueryui_icons [index ],item [3 ])
325+ self .toolitems [index ] = (
326+ item [0 ], item [1 ], jqueryui_icons [index ], item [3 ])
319327 self .message = ''
320328 self .cursor = 0
321329
@@ -361,7 +369,7 @@ class IndexPage(tornado.web.RequestHandler):
361369 def get (self , fignum ):
362370 with open (os .path .join (
363371 os .path .dirname (__file__ ),
364- 'web_static ' , 'index.html' )) as fd :
372+ 'web_backend ' , 'index.html' )) as fd :
365373 tpl = fd .read ()
366374
367375 fignum = int (fignum )
@@ -387,7 +395,7 @@ def get(self, fignum, format):
387395 'jpeg' : 'image/jpeg' ,
388396 'tif' : 'image/tiff' ,
389397 'emf' : 'application/emf'
390- }
398+ }
391399
392400 self .set_header ('Content-Type' , mimetypes .get (format , 'binary' ))
393401
@@ -438,25 +446,32 @@ def send_image(self):
438446 def __init__ (self ):
439447 super (WebAggApplication , self ).__init__ ([
440448 # Static files for the CSS and JS
441- (r'/static/(.*)' , tornado .web .StaticFileHandler ,
449+ (r'/static/(.*)' ,
450+ tornado .web .StaticFileHandler ,
442451 {'path' :
443- os .path .join (os .path .dirname (__file__ ), 'web_static ' )}),
452+ os .path .join (os .path .dirname (__file__ ), 'web_backend ' )}),
444453 # Static images for toolbar buttons
445- (r'/images/(.*)' , tornado .web .StaticFileHandler ,
454+ (r'/images/(.*)' ,
455+ tornado .web .StaticFileHandler ,
446456 {'path' :
447457 os .path .join (os .path .dirname (__file__ ), '../mpl-data/images' )}),
448- (r'/static/jquery/css/themes/base/(.*)' , tornado .web .StaticFileHandler ,
458+ (r'/static/jquery/css/themes/base/(.*)' ,
459+ tornado .web .StaticFileHandler ,
449460 {'path' :
450- os .path .join (os .path .dirname (__file__ ), 'web_static/jquery/css/themes/base' )}),
451- (r'/static/jquery/css/themes/base/images/(.*)' , tornado .web .StaticFileHandler ,
461+ os .path .join (os .path .dirname (__file__ ),
462+ 'web_backend/jquery/css/themes/base' )}),
463+ (r'/static/jquery/css/themes/base/images/(.*)' ,
464+ tornado .web .StaticFileHandler ,
452465 {'path' :
453- os .path .join (os .path .dirname (__file__ ), 'web_static/jquery/css/themes/base/images' )}),
466+ os .path .join (os .path .dirname (__file__ ),
467+ 'web_backend/jquery/css/themes/base/images' )}),
454468 (r'/static/jquery/js/(.*)' , tornado .web .StaticFileHandler ,
455469 {'path' :
456- os .path .join (os .path .dirname (__file__ ), 'web_static/jquery/js' )}),
470+ os .path .join (os .path .dirname (__file__ ),
471+ 'web_backend/jquery/js' )}),
457472 (r'/static/css/(.*)' , tornado .web .StaticFileHandler ,
458473 {'path' :
459- os .path .join (os .path .dirname (__file__ ), 'web_static /css' )}),
474+ os .path .join (os .path .dirname (__file__ ), 'web_backend /css' )}),
460475 # An MPL favicon
461476 (r'/favicon.ico' , self .FavIcon ),
462477 # The page that contains all of the pieces
@@ -466,7 +481,7 @@ def __init__(self):
466481 (r'/([0-9]+)/ws' , self .WebSocket ),
467482 # Handles the downloading (i.e., saving) of static images
468483 (r'/([0-9]+)/download.([a-z]+)' , self .Download )
469- ])
484+ ])
470485
471486 @classmethod
472487 def initialize (cls ):
0 commit comments