# HG changeset patch
# User Edouard Tisserant
# Date 1381540230 -32400
# Node ID 077bcba2d485bcf4f225cf6e07ddbc7b7495e84a
# Parent  7158aa05422637bb018c40ac82d6b2a02ffc0395
Cleaner matplotlib import preventing noisy warnings

diff -r 7158aa054226 -r 077bcba2d485 IDEFrame.py
--- a/IDEFrame.py	Fri Oct 11 12:10:40 2013 +0200
+++ b/IDEFrame.py	Sat Oct 12 10:10:30 2013 +0900
@@ -27,6 +27,8 @@
 from dialogs import ProjectDialog, PouDialog, PouTransitionDialog, PouActionDialog, FindInPouDialog, SearchInProjectDialog
 from util.BitmapLibrary import GetBitmap
 
+PouInstanceVariablesPanel.USE_MPL = USE_MPL
+
 # Define PLCOpenEditor controls id
 [ID_PLCOPENEDITOR, ID_PLCOPENEDITORLEFTNOTEBOOK, 
  ID_PLCOPENEDITORBOTTOMNOTEBOOK, ID_PLCOPENEDITORRIGHTNOTEBOOK, 
diff -r 7158aa054226 -r 077bcba2d485 controls/DebugVariablePanel/DebugVariableGraphicPanel.py
--- a/controls/DebugVariablePanel/DebugVariableGraphicPanel.py	Fri Oct 11 12:10:40 2013 +0200
+++ b/controls/DebugVariablePanel/DebugVariableGraphicPanel.py	Sat Oct 12 10:10:30 2013 +0900
@@ -30,7 +30,6 @@
 import wx.lib.buttons
 
 import matplotlib
-matplotlib.use('WX')
 import matplotlib.pyplot
 from matplotlib.backends.backend_wxagg import _convert_agg_to_wx_bitmap
 
diff -r 7158aa054226 -r 077bcba2d485 controls/DebugVariablePanel/DebugVariableGraphicViewer.py
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Fri Oct 11 12:10:40 2013 +0200
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Sat Oct 12 10:10:30 2013 +0900
@@ -29,7 +29,6 @@
 import wx
 
 import matplotlib
-matplotlib.use('WX')
 import matplotlib.pyplot
 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
 from matplotlib.backends.backend_wxagg import _convert_agg_to_wx_bitmap
diff -r 7158aa054226 -r 077bcba2d485 controls/DebugVariablePanel/DebugVariableViewer.py
--- a/controls/DebugVariablePanel/DebugVariableViewer.py	Fri Oct 11 12:10:40 2013 +0200
+++ b/controls/DebugVariablePanel/DebugVariableViewer.py	Sat Oct 12 10:10:30 2013 +0900
@@ -27,7 +27,6 @@
 import wx
 
 import matplotlib
-matplotlib.use('WX')
 import matplotlib.pyplot
 from matplotlib.backends.backend_wxagg import _convert_agg_to_wx_bitmap
 
diff -r 7158aa054226 -r 077bcba2d485 controls/PouInstanceVariablesPanel.py
--- a/controls/PouInstanceVariablesPanel.py	Fri Oct 11 12:10:40 2013 +0200
+++ b/controls/PouInstanceVariablesPanel.py	Sat Oct 12 10:10:30 2013 +0900
@@ -28,13 +28,6 @@
 import wx.lib.agw.customtreectrl as CT
 import wx.lib.buttons
 
-try:
-    import matplotlib
-    matplotlib.use('WX')
-    USE_MPL = True
-except:
-    USE_MPL = False
-
 # Customize CustomTreeItem for adding icon on item right
 CT.GenericTreeItem._rightimages = []
 
@@ -120,6 +113,8 @@
 from util.BitmapLibrary import GetBitmap
 
 class PouInstanceVariablesPanel(wx.Panel):
+
+    USE_MPL = False
     
     def __init__(self, parent, window, controller, debug):
         wx.Panel.__init__(self, name='PouInstanceTreePanel', 
@@ -252,7 +247,7 @@
                 
                 right_images = []
                 if var_infos.var_class in ITEMS_VARIABLE:
-                    if (not USE_MPL and var_infos.debug and self.Debug and
+                    if (not self.USE_MPL and var_infos.debug and self.Debug and
                         (self.Controller.IsOfType(var_infos.type, "ANY_NUM", True) or
                          self.Controller.IsOfType(var_infos.type, "ANY_BIT", True))):
                         right_images.append(self.InstanceGraphImage)