IDEFrame.py
changeset 930 4be515ac635e
parent 916 697d8b77d716
child 970 0dd89c8eeef5
equal deleted inserted replaced
929:c562031146e4 930:4be515ac635e
     3 import cPickle
     3 import cPickle
     4 from types import TupleType
     4 from types import TupleType
     5 
     5 
     6 import wx, wx.grid
     6 import wx, wx.grid
     7 import wx.aui
     7 import wx.aui
       
     8 
       
     9 try:
       
    10     import matplotlib
       
    11     matplotlib.use('WX')
       
    12     USE_MPL = True
       
    13 except:
       
    14     USE_MPL = False
     8 
    15 
     9 from editors.EditorPanel import EditorPanel
    16 from editors.EditorPanel import EditorPanel
    10 from editors.SFCViewer import SFC_Viewer
    17 from editors.SFCViewer import SFC_Viewer
    11 from editors.LDViewer import LD_Viewer
    18 from editors.LDViewer import LD_Viewer
    12 from editors.TextViewer import TextViewer
    19 from editors.TextViewer import TextViewer
  2012     def RefreshPouInstanceVariablesPanel(self):
  2019     def RefreshPouInstanceVariablesPanel(self):
  2013         self.PouInstanceVariablesPanel.RefreshView()
  2020         self.PouInstanceVariablesPanel.RefreshView()
  2014 
  2021 
  2015     def OpenDebugViewer(self, instance_category, instance_path, instance_type):
  2022     def OpenDebugViewer(self, instance_category, instance_path, instance_type):
  2016         openedidx = self.IsOpened(instance_path)
  2023         openedidx = self.IsOpened(instance_path)
       
  2024         new_window = None
  2017         if openedidx is not None:
  2025         if openedidx is not None:
  2018             old_selected = self.TabsOpened.GetSelection()
  2026             old_selected = self.TabsOpened.GetSelection()
  2019             if old_selected != openedidx:
  2027             if old_selected != openedidx:
  2020                 if old_selected >= 0:
  2028                 if old_selected >= 0:
  2021                     self.TabsOpened.GetPage(old_selected).ResetBuffer()
  2029                     self.TabsOpened.GetPage(old_selected).ResetBuffer()
  2022                 self.TabsOpened.SetSelection(openedidx)
  2030                 self.TabsOpened.SetSelection(openedidx)
  2023         
  2031         
  2024         elif instance_category in ITEMS_VARIABLE:
  2032         elif instance_category in ITEMS_VARIABLE:
  2025             if self.Controler.IsNumType(instance_type, True):
  2033             if self.Controler.IsNumType(instance_type, True):
  2026                 new_window = GraphicViewer(self.TabsOpened, self, self.Controler, instance_path)
  2034                 if USE_MPL:
  2027                 icon = GetBitmap("GRAPH")
  2035                     self.AddDebugVariable(instance_path, True)
       
  2036                 else:
       
  2037                     new_window = GraphicViewer(self.TabsOpened, self, self.Controler, instance_path)
       
  2038                     icon = GetBitmap("GRAPH")
  2028         
  2039         
  2029         else:
  2040         else:
  2030             bodytype = self.Controler.GetEditedElementBodyType(instance_type, True)
  2041             bodytype = self.Controler.GetEditedElementBodyType(instance_type, True)
  2031             new_window = None
       
  2032             if bodytype == "FBD":
  2042             if bodytype == "FBD":
  2033                 new_window = Viewer(self.TabsOpened, instance_type, self, self.Controler, True, instance_path)
  2043                 new_window = Viewer(self.TabsOpened, instance_type, self, self.Controler, True, instance_path)
  2034                 new_window.RefreshScaling(False)
  2044                 new_window.RefreshScaling(False)
  2035             elif bodytype == "LD":
  2045             elif bodytype == "LD":
  2036                 new_window = LD_Viewer(self.TabsOpened, instance_type, self, self.Controler, True, instance_path)
  2046                 new_window = LD_Viewer(self.TabsOpened, instance_type, self, self.Controler, True, instance_path)