From 68de9439cd3911e2fffe5eba7b741ae65bf9181d Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Thu, 21 Feb 2019 18:09:16 -0500 Subject: [PATCH] Fix matplotlib wasm backend after undefined attribute behavior changed --- packages/matplotlib/src/wasm_backend.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/matplotlib/src/wasm_backend.py b/packages/matplotlib/src/wasm_backend.py index 88a7ac41e..ecced2f43 100644 --- a/packages/matplotlib/src/wasm_backend.py +++ b/packages/matplotlib/src/wasm_backend.py @@ -90,15 +90,15 @@ class FigureCanvasWasm(backend_agg.FigureCanvasAgg): This is typically 2 on a HiDPI ("Retina") display, and 1 otherwise. """ backing_store = ( - context.backingStorePixelRatio or - context.webkitBackingStorePixel or - context.mozBackingStorePixelRatio or - context.msBackingStorePixelRatio or - context.oBackingStorePixelRatio or - context.backendStorePixelRatio or + getattr(context, 'backingStorePixelRatio', 0) or + getattr(context, 'webkitBackingStorePixel', 0) or + getattr(context, 'mozBackingStorePixelRatio', 0) or + getattr(context, 'msBackingStorePixelRatio', 0) or + getattr(context, 'oBackingStorePixelRatio', 0) or + getattr(context, 'backendStorePixelRatio', 0) or 1 ) - return (window.devicePixelRatio or 1) / backing_store + return (getattr(window, 'devicePixelRatio', 0) or 1) / backing_store def create_root_element(self): # Designed to be overridden by subclasses for use in contexts other