From 542542f48d9937dfbae06ba8d54ab4fd89e545c7 Mon Sep 17 00:00:00 2001 From: blitzman Date: Tue, 7 Feb 2017 00:33:15 -0500 Subject: [PATCH] import changes to graphframe --- gui/graphFrame.py | 18 ++++++++++++++---- gui/mainMenuBar.py | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gui/graphFrame.py b/gui/graphFrame.py index 9b6520a5f..7b56c0ed0 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -19,6 +19,7 @@ import os import logging +import imp import wx @@ -30,15 +31,15 @@ from gui.graph import Graph from gui.bitmapLoader import BitmapLoader from config import parsePath +# Don't actually import the thing, since it takes for fucking ever try: - import matplotlib as mpl - from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas - from matplotlib.figure import Figure + imp.find_module('matplotlib') enabled = True - mplImported = False except ImportError: enabled = False +mplImported = False + logger = logging.getLogger(__name__) if not enabled: logger.info("Problems importing matplotlib; continuing without graphs") @@ -50,6 +51,15 @@ class GraphFrame(wx.Frame): global enabled global mplImported + # Import here + try: + import matplotlib as mpl + from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas + from matplotlib.figure import Figure + enabled = True + except ImportError: + enabled = False + self.legendFix = False if not enabled: return diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index b543998c2..7473c45cb 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -22,7 +22,7 @@ import wx import config from service.character import Character import gui.mainFrame -import gui.graphFrame +#import gui.graphFrame import gui.globalEvents as GE from gui.bitmapLoader import BitmapLoader