PLCControler.py
changeset 101 3f06a178b960
parent 100 4e3f5b320bc3
child 107 255eada20688
equal deleted inserted replaced
100:4e3f5b320bc3 101:3f06a178b960
  1453             pou = self.Project.getPou(words[1])
  1453             pou = self.Project.getPou(words[1])
  1454             for type, varlist in pou.getVars():
  1454             for type, varlist in pou.getVars():
  1455                 for var in varlist.getVariable():
  1455                 for var in varlist.getVariable():
  1456                     if var.getName() == varname:
  1456                     if var.getName() == varname:
  1457                         return var.getType().getValue()
  1457                         return var.getType().getValue()
  1458         return ""
  1458         return None
  1459     
  1459     
  1460     def SetConnectionWires(self, connection, connector):
  1460     def SetConnectionWires(self, connection, connector):
  1461         wires = connector.GetWires()
  1461         wires = connector.GetWires()
  1462         idx = 0
  1462         idx = 0
  1463         for wire, handle in wires:
  1463         for wire, handle in wires:
  1973     def RemoveCurrentElementEditingInstance(self, id):
  1973     def RemoveCurrentElementEditingInstance(self, id):
  1974         element = self.GetCurrentElementEditing()
  1974         element = self.GetCurrentElementEditing()
  1975         instance = element.getInstance(id)
  1975         instance = element.getInstance(id)
  1976         if isinstance(instance, plcopen.block):
  1976         if isinstance(instance, plcopen.block):
  1977             blocktype = instance.getTypeName()
  1977             blocktype = instance.getTypeName()
  1978             blocktype_infos = GetBlockType(blocktype)
  1978             if self.CurrentElementEditing != None:
  1979             if blocktype_infos["type"] != "function":
  1979                 name = self.ElementsOpened[self.CurrentElementEditing]
  1980                 if self.CurrentElementEditing != None:
  1980                 words = name.split("::")
  1981                     name = self.ElementsOpened[self.CurrentElementEditing]
  1981                 if words[0] in ["P","T","A"]:
  1982                     words = name.split("::")
  1982                     pou = self.Project.getPou(words[1])
  1983                     if words[0] in ["P","T","A"]:
  1983                     pou.removePouVar(blocktype, instance.getInstanceName())    
  1984                         pou = self.Project.getPou(words[1])
       
  1985                         pou.removePouVar(blocktype, instance.getInstanceName())    
       
  1986         element.removeInstance(id)
  1984         element.removeInstance(id)
  1987         self.RefreshPouUsingTree()
  1985         self.RefreshPouUsingTree()
  1988 
  1986 
  1989     def GetCurrentResourceEditingVariables(self):
  1987     def GetCurrentResourceEditingVariables(self):
  1990         varlist = []
  1988         varlist = []