Cleaner matplotlib import preventing noisy warnings
authorEdouard Tisserant
Sat, 12 Oct 2013 10:10:30 +0900
changeset 1362 077bcba2d485
parent 1361 7158aa054226
child 1363 e87e0166d0a7
Cleaner matplotlib import preventing noisy warnings
IDEFrame.py
controls/DebugVariablePanel/DebugVariableGraphicPanel.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
controls/DebugVariablePanel/DebugVariableViewer.py
controls/PouInstanceVariablesPanel.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, 
--- 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
 
--- 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
--- 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
 
--- 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)