641 def ExtractVarLists(self, vars): |
641 def ExtractVarLists(self, vars): |
642 varlist_list = [] |
642 varlist_list = [] |
643 current_varlist = None |
643 current_varlist = None |
644 current_type = None |
644 current_type = None |
645 for var in vars: |
645 for var in vars: |
646 if current_type != (var["Class"], var["Retain"], var["Constant"], var["Location"] in ["", None]): |
646 next_type = (var["Class"], |
647 current_type = (var["Class"], var["Retain"], var["Constant"], var["Location"] in ["", None]) |
647 var["Retain"], |
|
648 var["Constant"], |
|
649 var["Location"] in ["", None] or |
|
650 # When declaring globals, located |
|
651 # and not located variables are |
|
652 # in the same declaration block |
|
653 var["Class"] == "Global") |
|
654 if current_type != next_type: |
|
655 current_type = next_type |
648 if var["Class"] == "Local": |
656 if var["Class"] == "Local": |
649 current_varlist = plcopen.interface_localVars() |
657 current_varlist = plcopen.interface_localVars() |
650 elif var["Class"] == "Global": |
658 elif var["Class"] == "Global": |
651 current_varlist = plcopen.interface_globalVars() |
659 current_varlist = plcopen.interface_globalVars() |
652 elif var["Class"] == "External": |
660 elif var["Class"] == "External": |
1683 old_type = block.gettypeName() |
1691 old_type = block.gettypeName() |
1684 new_name = infos.get("name", old_name) |
1692 new_name = infos.get("name", old_name) |
1685 new_type = infos.get("type", old_type) |
1693 new_type = infos.get("type", old_type) |
1686 old_typeinfos = self.GetBlockType(old_type) |
1694 old_typeinfos = self.GetBlockType(old_type) |
1687 new_typeinfos = self.GetBlockType(new_type) |
1695 new_typeinfos = self.GetBlockType(new_type) |
1688 if new_typeinfos["type"] != old_typeinfos["type"]: |
1696 if new_type != old_type and new_typeinfos["type"] != old_typeinfos["type"]: |
1689 if new_typeinfos["type"] == "function": |
1697 if new_typeinfos["type"] == "function": |
1690 self.RemoveEditedElementPouVar(tagname, old_type, old_name) |
1698 self.RemoveEditedElementPouVar(tagname, old_type, old_name) |
1691 else: |
1699 else: |
1692 self.AddEditedElementPouVar(tagname, new_type, new_name) |
1700 self.AddEditedElementPouVar(tagname, new_type, new_name) |
1693 elif new_typeinfos["type"] != "function" and old_name != new_name: |
1701 elif old_name != new_name and new_typeinfos["type"] != "function": |
1694 self.ChangeEditedElementPouVar(tagname, old_type, old_name, new_type, new_name) |
1702 self.ChangeEditedElementPouVar(tagname, old_type, old_name, new_type, new_name) |
1695 for param, value in infos.items(): |
1703 for param, value in infos.items(): |
1696 if param == "name": |
1704 if param == "name": |
1697 block.setinstanceName(value) |
1705 block.setinstanceName(value) |
1698 elif param == "type": |
1706 elif param == "type": |