controls/PouInstanceVariablesPanel.py
changeset 1362 077bcba2d485
parent 1348 aee0a7eb833a
child 1364 e9e17d3b2849
equal deleted inserted replaced
1361:7158aa054226 1362:077bcba2d485
    26 
    26 
    27 import wx
    27 import wx
    28 import wx.lib.agw.customtreectrl as CT
    28 import wx.lib.agw.customtreectrl as CT
    29 import wx.lib.buttons
    29 import wx.lib.buttons
    30 
    30 
    31 try:
       
    32     import matplotlib
       
    33     matplotlib.use('WX')
       
    34     USE_MPL = True
       
    35 except:
       
    36     USE_MPL = False
       
    37 
       
    38 # Customize CustomTreeItem for adding icon on item right
    31 # Customize CustomTreeItem for adding icon on item right
    39 CT.GenericTreeItem._rightimages = []
    32 CT.GenericTreeItem._rightimages = []
    40 
    33 
    41 def SetRightImages(self, images):
    34 def SetRightImages(self, images):
    42     self._rightimages = images
    35     self._rightimages = images
   118 
   111 
   119 from PLCControler import ITEMS_VARIABLE, ITEM_CONFIGURATION, ITEM_RESOURCE, ITEM_POU, ITEM_TRANSITION, ITEM_ACTION
   112 from PLCControler import ITEMS_VARIABLE, ITEM_CONFIGURATION, ITEM_RESOURCE, ITEM_POU, ITEM_TRANSITION, ITEM_ACTION
   120 from util.BitmapLibrary import GetBitmap
   113 from util.BitmapLibrary import GetBitmap
   121 
   114 
   122 class PouInstanceVariablesPanel(wx.Panel):
   115 class PouInstanceVariablesPanel(wx.Panel):
       
   116 
       
   117     USE_MPL = False
   123     
   118     
   124     def __init__(self, parent, window, controller, debug):
   119     def __init__(self, parent, window, controller, debug):
   125         wx.Panel.__init__(self, name='PouInstanceTreePanel', 
   120         wx.Panel.__init__(self, name='PouInstanceTreePanel', 
   126                 parent=parent, pos=wx.Point(0, 0), 
   121                 parent=parent, pos=wx.Point(0, 0), 
   127                 size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   122                 size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   250                 else:
   245                 else:
   251                     text = var_infos.name
   246                     text = var_infos.name
   252                 
   247                 
   253                 right_images = []
   248                 right_images = []
   254                 if var_infos.var_class in ITEMS_VARIABLE:
   249                 if var_infos.var_class in ITEMS_VARIABLE:
   255                     if (not USE_MPL and var_infos.debug and self.Debug and
   250                     if (not self.USE_MPL and var_infos.debug and self.Debug and
   256                         (self.Controller.IsOfType(var_infos.type, "ANY_NUM", True) or
   251                         (self.Controller.IsOfType(var_infos.type, "ANY_NUM", True) or
   257                          self.Controller.IsOfType(var_infos.type, "ANY_BIT", True))):
   252                          self.Controller.IsOfType(var_infos.type, "ANY_BIT", True))):
   258                         right_images.append(self.InstanceGraphImage)
   253                         right_images.append(self.InstanceGraphImage)
   259                 elif var_infos.edit:
   254                 elif var_infos.edit:
   260                     right_images.append(self.EditImage)
   255                     right_images.append(self.EditImage)