controls/LibraryPanel.py
changeset 1742 92932cd370a4
parent 1739 ec153828ded2
child 1744 69dfdb26f600
equal deleted inserted replaced
1741:dd94b9a68c61 1742:92932cd370a4
    82 
    82 
    83         # Add TreeCtrl for functions and function blocks library in splitter
    83         # Add TreeCtrl for functions and function blocks library in splitter
    84         # window
    84         # window
    85         self.Tree = wx.TreeCtrl(splitter_window,
    85         self.Tree = wx.TreeCtrl(splitter_window,
    86               size=wx.Size(0, 0),
    86               size=wx.Size(0, 0),
    87               style=wx.TR_HAS_BUTTONS|
    87               style=wx.TR_HAS_BUTTONS |
    88                     wx.TR_SINGLE|
    88                     wx.TR_SINGLE      |
    89                     wx.SUNKEN_BORDER|
    89                     wx.SUNKEN_BORDER  |
    90                     wx.TR_HIDE_ROOT|
    90                     wx.TR_HIDE_ROOT   |
    91                     wx.TR_LINES_AT_ROOT)
    91                     wx.TR_LINES_AT_ROOT)
    92         self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeItemSelected, self.Tree)
    92         self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeItemSelected, self.Tree)
    93         self.Tree.Bind(wx.EVT_CHAR, self.OnKeyDown)
    93         self.Tree.Bind(wx.EVT_CHAR, self.OnKeyDown)
    94         # If drag'n drop is enabled, bind event generated when a drag begins on
    94         # If drag'n drop is enabled, bind event generated when a drag begins on
    95         # tree to start a drag'n drop
    95         # tree to start a drag'n drop
   341             type_extension = item_pydata.get("extension", None)
   341             type_extension = item_pydata.get("extension", None)
   342             if inputs is not None and type_inputs is not None:
   342             if inputs is not None and type_inputs is not None:
   343                 same_inputs = reduce(
   343                 same_inputs = reduce(
   344                     lambda x, y: x and y,
   344                     lambda x, y: x and y,
   345                     map(
   345                     map(
   346                         lambda x: x[0]==x[1] or x[0]=='ANY' or x[1]=='ANY',
   346                         lambda x: x[0] == x[1] or x[0] == 'ANY' or x[1] == 'ANY',
   347                         zip(type_inputs,
   347                         zip(type_inputs,
   348                             (inputs[:type_extension]
   348                             (inputs[:type_extension]
   349                              if type_extension is not None
   349                              if type_extension is not None
   350                              else inputs))),
   350                              else inputs))),
   351                     True)
   351                     True)