IDEFrame.py
changeset 1024 626de4ff4bdc
parent 1019 e5686874eaef
child 1028 0ddbc39c91ee
equal deleted inserted replaced
1023:93022adef055 1024:626de4ff4bdc
  1824                 parent = self.ProjectTree.GetItemParent(item)
  1824                 parent = self.ProjectTree.GetItemParent(item)
  1825                 parent_type = self.ProjectTree.GetPyData(parent)["type"]
  1825                 parent_type = self.ProjectTree.GetPyData(parent)["type"]
  1826                 while parent_type not in [ITEM_CONFIGURATION, ITEM_PROJECT]:
  1826                 while parent_type not in [ITEM_CONFIGURATION, ITEM_PROJECT]:
  1827                     parent = self.ProjectTree.GetItemParent(parent)
  1827                     parent = self.ProjectTree.GetItemParent(parent)
  1828                     parent_type = self.ProjectTree.GetPyData(parent)["type"]
  1828                     parent_type = self.ProjectTree.GetPyData(parent)["type"]
       
  1829                 parent_name = None
  1829                 if parent_type == ITEM_PROJECT:
  1830                 if parent_type == ITEM_PROJECT:
  1830                     parent_name = None
  1831                     config_names = self.Controler.GetProjectConfigNames()
       
  1832                     if len(config_names) > 0:
       
  1833                         parent_name = config_names[0]
  1831                 else:
  1834                 else:
  1832                     parent_name = self.ProjectTree.GetItemText(parent)
  1835                     parent_name = self.ProjectTree.GetItemText(parent)
  1833                 self.Bind(wx.EVT_MENU, self.GenerateAddResourceFunction(parent_name), id=new_id)
  1836                 if parent_name is not None:
       
  1837                     self.Bind(wx.EVT_MENU, self.GenerateAddResourceFunction(parent_name), id=new_id)
  1834             
  1838             
  1835         else:
  1839         else:
  1836             if item_infos["type"] == ITEM_POU:
  1840             if item_infos["type"] == ITEM_POU:
  1837                 menu = wx.Menu(title='')
  1841                 menu = wx.Menu(title='')
  1838                 if self.Controler.GetPouBodyType(name) == "SFC":
  1842                 if self.Controler.GetPouBodyType(name) == "SFC":