opc_ua/opcua_client_maker.py
changeset 3373 78add3f69e39
parent 3370 3c31dce1a661
child 3371 d486b98d7005
child 3377 c25a752b664e
equal deleted inserted replaced
3372:e5cb7447320c 3373:78add3f69e39
     5 
     5 
     6 from opcua import Client
     6 from opcua import Client
     7 from opcua import ua
     7 from opcua import ua
     8 
     8 
     9 import wx
     9 import wx
    10 import wx.lib.gizmos as gizmos  # Formerly wx.gizmos in Classic
    10 from wx.lib.agw.hypertreelist import HyperTreeList as TreeListCtrl
    11 import wx.dataview as dv
    11 import wx.dataview as dv
    12 
    12 
    13 
    13 
    14 UA_IEC_types = dict(
    14 UA_IEC_types = dict(
    15 #   pyopcua | IEC61131|  C  type  | sz |  open62541  enum  | open62541
    15 #   pyopcua | IEC61131|  C  type  | sz |  open62541  enum  | open62541
    36 lstcolwidths = [     100,      50,      100,  100,    100,    50]
    36 lstcolwidths = [     100,      50,      100,  100,    100,    50]
    37 lstcoltypess = [     str,     int,      str,  str,    str,   int]
    37 lstcoltypess = [     str,     int,      str,  str,    str,   int]
    38 
    38 
    39 directions = ["input", "output"]
    39 directions = ["input", "output"]
    40 
    40 
    41 class OPCUASubListModel(dv.DataViewIndexListModel):
    41 class OPCUASubListModel(dv.PyDataViewIndexListModel):
    42     def __init__(self, data, log):
    42     def __init__(self, data, log):
    43         dv.DataViewIndexListModel.__init__(self, len(data))
    43         dv.PyDataViewIndexListModel.__init__(self, len(data))
    44         self.data = data
    44         self.data = data
    45         self.log = log
    45         self.log = log
    46 
    46 
    47     def GetColumnType(self, col):
    47     def GetColumnType(self, col):
    48         return "string"
    48         return "string"
   308             self.tree_panel = wx.Panel(self)
   308             self.tree_panel = wx.Panel(self)
   309             self.tree_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
   309             self.tree_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=0)
   310             self.tree_sizer.AddGrowableCol(0)
   310             self.tree_sizer.AddGrowableCol(0)
   311             self.tree_sizer.AddGrowableRow(0)
   311             self.tree_sizer.AddGrowableRow(0)
   312 
   312 
   313             self.tree = gizmos.TreeListCtrl(self.tree_panel, -1, style=0, agwStyle=
   313             self.tree = TreeListCtrl(self.tree_panel, -1, style=0, agwStyle=
   314                                             gizmos.TR_DEFAULT_STYLE
   314                                             wx.TR_DEFAULT_STYLE
   315                                             | gizmos.TR_MULTIPLE
   315                                             | wx.TR_MULTIPLE
   316                                             | gizmos.TR_FULL_ROW_HIGHLIGHT
   316                                             | wx.TR_FULL_ROW_HIGHLIGHT
   317                                        )
   317                                        )
   318 
   318 
   319             prepare_image_list()
   319             prepare_image_list()
   320             self.tree.SetImageList(il)
   320             self.tree.SetImageList(il)
   321 
   321