PLCControler.py
changeset 435 893d04aff708
parent 431 c1c92d068ac5
child 447 6083dcecd2c5
equal deleted inserted replaced
434:8a0dfd22c408 435:893d04aff708
    72                    "Temp" :     (plcopen.interface_tempVars,     ITEM_VAR_TEMP),
    72                    "Temp" :     (plcopen.interface_tempVars,     ITEM_VAR_TEMP),
    73                    "Input" :    (plcopen.interface_inputVars,    ITEM_VAR_INPUT),
    73                    "Input" :    (plcopen.interface_inputVars,    ITEM_VAR_INPUT),
    74                    "Output" :   (plcopen.interface_outputVars,   ITEM_VAR_OUTPUT),
    74                    "Output" :   (plcopen.interface_outputVars,   ITEM_VAR_OUTPUT),
    75                    "InOut" :    (plcopen.interface_inOutVars,    ITEM_VAR_INOUT)
    75                    "InOut" :    (plcopen.interface_inOutVars,    ITEM_VAR_INOUT)
    76                   }
    76                   }
       
    77 
       
    78 LOCATIONS_ITEMS = [LOCATION_PLUGIN,
       
    79                    LOCATION_MODULE,
       
    80                    LOCATION_GROUP,
       
    81                    LOCATION_VAR_INPUT,
       
    82                    LOCATION_VAR_OUTPUT,
       
    83                    LOCATION_VAR_MEMORY] = range(6)
    77 
    84 
    78 ScriptDirectory = os.path.split(os.path.realpath(__file__))[0]
    85 ScriptDirectory = os.path.split(os.path.realpath(__file__))[0]
    79 
    86 
    80 def GetUneditableNames():
    87 def GetUneditableNames():
    81     _ = lambda x:x
    88     _ = lambda x:x
  1167         
  1174         
  1168     # Function that clear the plugin list
  1175     # Function that clear the plugin list
  1169     def ClearPluginTypes(self):
  1176     def ClearPluginTypes(self):
  1170         for i in xrange(len(self.PluginTypes)):
  1177         for i in xrange(len(self.PluginTypes)):
  1171             self.PluginTypes.pop(0)
  1178             self.PluginTypes.pop(0)
       
  1179 
       
  1180     def GetVariableLocationTree(self):
       
  1181         return []
  1172 
  1182 
  1173     # Function that returns the block definition associated to the block type given
  1183     # Function that returns the block definition associated to the block type given
  1174     def GetBlockType(self, type, inputs = None, debug = False):
  1184     def GetBlockType(self, type, inputs = None, debug = False):
  1175         for category in BlockTypes + self.PluginTypes:
  1185         for category in BlockTypes + self.PluginTypes:
  1176             for blocktype in category["list"]:
  1186             for blocktype in category["list"]:
  1846                     connection.setconnectionParameter(idx, formalParameter)
  1856                     connection.setconnectionParameter(idx, formalParameter)
  1847                 else:
  1857                 else:
  1848                     connection.setconnectionParameter(idx, None)
  1858                     connection.setconnectionParameter(idx, None)
  1849                 idx += 1
  1859                 idx += 1
  1850     
  1860     
  1851     def AddEditedElementPouVar(self, tagname, type, name):
  1861     def AddEditedElementPouVar(self, tagname, type, name, location="", description=""):
  1852         if self.Project is not None:
  1862         if self.Project is not None:
  1853             words = tagname.split("::")
  1863             words = tagname.split("::")
  1854             if words[0] in ['P', 'T', 'A']:
  1864             if words[0] in ['P', 'T', 'A']:
  1855                 pou = self.Project.getpou(words[1])
  1865                 pou = self.Project.getpou(words[1])
  1856                 if pou is not None:
  1866                 if pou is not None:
  1857                     if pou.interface is None:
  1867                     if pou.interface is None:
  1858                         pou.interface = plcopen.pou_interface()
  1868                         pou.interface = plcopen.pou_interface()
  1859                     pou.addpouVar(type, name)
  1869                     pou.addpouVar(type, name, location, description)
  1860             
  1870             
  1861     def ChangeEditedElementPouVar(self, tagname, old_type, old_name, new_type, new_name):
  1871     def ChangeEditedElementPouVar(self, tagname, old_type, old_name, new_type, new_name):
  1862         if self.Project is not None:
  1872         if self.Project is not None:
  1863             words = tagname.split("::")
  1873             words = tagname.split("::")
  1864             if words[0] in ['P', 'T', 'A']:
  1874             if words[0] in ['P', 'T', 'A']: