controls/LibraryPanel.py
changeset 1739 ec153828ded2
parent 1736 7e61baa047f0
child 1742 92932cd370a4
equal deleted inserted replaced
1738:d2e979738700 1739:ec153828ded2
   210                         category_item, root_cookie = \
   210                         category_item, root_cookie = \
   211                             self.Tree.GetNextChild(root, root_cookie)
   211                             self.Tree.GetNextChild(root, root_cookie)
   212 
   212 
   213                 # Set data associated to tree item (only save that item is a
   213                 # Set data associated to tree item (only save that item is a
   214                 # category)
   214                 # category)
   215                 self.Tree.SetPyData(category_item, {"type" : CATEGORY})
   215                 self.Tree.SetPyData(category_item, {"type": CATEGORY})
   216 
   216 
   217                 # Iterate over functions and function blocks defined in library
   217                 # Iterate over functions and function blocks defined in library
   218                 # category add a tree item to category tree item for each of
   218                 # category add a tree item to category tree item for each of
   219                 # them
   219                 # them
   220 
   220 
   237                                 self.Tree.GetNextChild(category_item,
   237                                 self.Tree.GetNextChild(category_item,
   238                                                        category_cookie)
   238                                                        category_cookie)
   239 
   239 
   240                     # Define data to associate to block tree item
   240                     # Define data to associate to block tree item
   241                     comment = blocktype["comment"]
   241                     comment = blocktype["comment"]
   242                     block_data = {"type" : BLOCK,
   242                     block_data = {
   243                                   "block_type" : blocktype["type"],
   243                         "type":       BLOCK,
   244                                   "inputs" : tuple([type
   244                         "block_type": blocktype["type"],
   245                                                     for name, type, modifier
   245                         "inputs":     tuple([type
   246                                                     in blocktype["inputs"]]),
   246                                              for name, type, modifier
   247                                   "extension" : (len(blocktype["inputs"])
   247                                              in blocktype["inputs"]]),
   248                                                  if blocktype["extensible"]
   248                         "extension":  (len(blocktype["inputs"])
   249                                                  else None),
   249                                       if blocktype["extensible"] else None),
   250                                   "comment": _(comment) +
   250                         "comment":    _(comment) + blocktype.get("usage", "")
   251                                              blocktype.get("usage", "")}
   251                     }
   252                     self.Tree.SetPyData(blocktype_item, block_data)
   252                     self.Tree.SetPyData(blocktype_item, block_data)
   253 
   253 
   254                     # Select block tree item in tree if it corresponds to
   254                     # Select block tree item in tree if it corresponds to
   255                     # previously selected one
   255                     # previously selected one
   256                     if selected_infos == (blocktype["name"],
   256                     if selected_infos == (blocktype["name"],