plcopen/types_enums.py
changeset 1953 5736d25bb393
parent 1948 b9a3f771aaab
child 2524 c80b0d864475
equal deleted inserted replaced
1952:0c20fc810d61 1953:5736d25bb393
    71                    LOCATION_VAR_INPUT,
    71                    LOCATION_VAR_INPUT,
    72                    LOCATION_VAR_OUTPUT,
    72                    LOCATION_VAR_OUTPUT,
    73                    LOCATION_VAR_MEMORY] = range(6)
    73                    LOCATION_VAR_MEMORY] = range(6)
    74 
    74 
    75 UNEDITABLE_NAMES = [_("User-defined POUs"), _("Functions"), _("Function Blocks"),
    75 UNEDITABLE_NAMES = [_("User-defined POUs"), _("Functions"), _("Function Blocks"),
    76             _("Programs"), _("Data Types"), _("Transitions"), _("Actions"),
    76                     _("Programs"), _("Data Types"), _("Transitions"), _("Actions"),
    77             _("Configurations"), _("Resources"), _("Properties")]
    77                     _("Configurations"), _("Resources"), _("Properties")]
    78 
    78 
    79 [USER_DEFINED_POUS, FUNCTIONS, FUNCTION_BLOCKS, PROGRAMS,
    79 [USER_DEFINED_POUS, FUNCTIONS, FUNCTION_BLOCKS, PROGRAMS,
    80  DATA_TYPES, TRANSITIONS, ACTIONS, CONFIGURATIONS,
    80  DATA_TYPES, TRANSITIONS, ACTIONS, CONFIGURATIONS,
    81  RESOURCES, PROPERTIES] = UNEDITABLE_NAMES
    81  RESOURCES, PROPERTIES] = UNEDITABLE_NAMES
    82 
    82 
    83 # -------------------------------------------------------------------------------
    83 # -------------------------------------------------------------------------------
    84 #                   Project Element tag name computation functions
    84 #                   Project Element tag name computation functions
    85 # -------------------------------------------------------------------------------
    85 # -------------------------------------------------------------------------------
    86 
    86 
       
    87 
    87 # Compute a data type name
    88 # Compute a data type name
    88 def ComputeDataTypeName(datatype):
    89 def ComputeDataTypeName(datatype):
    89     return "D::%s" % datatype
    90     return "D::%s" % datatype
       
    91 
    90 
    92 
    91 # Compute a pou name
    93 # Compute a pou name
    92 def ComputePouName(pou):
    94 def ComputePouName(pou):
    93     return "P::%s" % pou
    95     return "P::%s" % pou
    94 
    96 
       
    97 
    95 # Compute a pou transition name
    98 # Compute a pou transition name
    96 def ComputePouTransitionName(pou, transition):
    99 def ComputePouTransitionName(pou, transition):
    97     return "T::%s::%s" % (pou, transition)
   100     return "T::%s::%s" % (pou, transition)
       
   101 
    98 
   102 
    99 # Compute a pou action name
   103 # Compute a pou action name
   100 def ComputePouActionName(pou, action):
   104 def ComputePouActionName(pou, action):
   101     return "A::%s::%s" % (pou, action)
   105     return "A::%s::%s" % (pou, action)
   102 
   106 
       
   107 
   103 # Compute a pou  name
   108 # Compute a pou  name
   104 def ComputeConfigurationName(config):
   109 def ComputeConfigurationName(config):
   105     return "C::%s" % config
   110     return "C::%s" % config
   106 
   111 
       
   112 
   107 # Compute a pou  name
   113 # Compute a pou  name
   108 def ComputeConfigurationResourceName(config, resource):
   114 def ComputeConfigurationResourceName(config, resource):
   109     return "R::%s::%s" % (config, resource)
   115     return "R::%s::%s" % (config, resource)
       
   116 
   110 
   117 
   111 def GetElementType(tagname):
   118 def GetElementType(tagname):
   112     words = tagname.split("::")
   119     words = tagname.split("::")
   113     return {
   120     return {
   114         "D": ITEM_DATATYPE,
   121         "D": ITEM_DATATYPE,