def GenerateTreeMenu(self, x, y, scaling, menu, base_path, var_class, tree):
for child_name, child_type, (child_tree, child_dimensions) in tree:
if base_path:
child_path = "%s.%s" % (base_path, child_name)
else:
child_path = child_name
if len(child_dimensions) > 0:
child_path += "[%s]" % ",".join([str(dimension[0]) for dimension in child_dimensions])
child_name += "[]"
new_id = wx.NewId()
AppendMenu(menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=child_name)
self.ParentWindow.Bind(wx.EVT_MENU, self.GetAddVariableBlockFunction(x, y, scaling, var_class, child_path, child_type), id=new_id)
if len(child_tree) > 0:
new_id = wx.NewId()
child_menu = wx.Menu(title='')
self.GenerateTreeMenu(x, y, scaling, child_menu, child_path, var_class, child_tree)
menu.AppendMenu(new_id, "%s." % child_name, child_menu)
评论列表
文章目录