PLCControler.py
changeset 1831 56b48961cc68
parent 1785 0ff2a45dcefa
child 1832 0f1081928d65
equal deleted inserted replaced
1830:e598d1acf354 1831:56b48961cc68
   167 
   167 
   168     def copy(self):
   168     def copy(self):
   169         return _VariableInfos(*[getattr(self, attr) for attr in self.__slots__])
   169         return _VariableInfos(*[getattr(self, attr) for attr in self.__slots__])
   170 
   170 
   171 
   171 
   172 class VariablesInfosFactory:
   172 class VariablesInfosFactory(object):
   173 
   173 
   174     def __init__(self, variables):
   174     def __init__(self, variables):
   175         self.Variables = variables
   175         self.Variables = variables
   176         self.TreeStack = []
   176         self.TreeStack = []
   177         self.Type = None
   177         self.Type = None
   240 
   240 
   241     def copy(self):
   241     def copy(self):
   242         return _VariableTreeItem(*[getattr(self, attr) for attr in self.__slots__])
   242         return _VariableTreeItem(*[getattr(self, attr) for attr in self.__slots__])
   243 
   243 
   244 
   244 
   245 class VariablesTreeInfosFactory:
   245 class VariablesTreeInfosFactory(object):
   246 
   246 
   247     def __init__(self):
   247     def __init__(self):
   248         self.Root = None
   248         self.Root = None
   249 
   249 
   250     def GetRoot(self):
   250     def GetRoot(self):
   262                 *(_translate_args(
   262                 *(_translate_args(
   263                     [_StringValue, class_extraction, _StringValue] +
   263                     [_StringValue, class_extraction, _StringValue] +
   264                     [_BoolValue] * 2, args) + [[]])))
   264                     [_BoolValue] * 2, args) + [[]])))
   265 
   265 
   266 
   266 
   267 class InstancesPathFactory:
   267 class InstancesPathFactory(object):
   268     """Helpers object for generating instances path list"""
   268     """Helpers object for generating instances path list"""
   269     def __init__(self, instances):
   269     def __init__(self, instances):
   270         self.Instances = instances
   270         self.Instances = instances
   271 
   271 
   272     def AddInstance(self, context, *args):
   272     def AddInstance(self, context, *args):
   273         self.Instances.append(args[0][0])
   273         self.Instances.append(args[0][0])
   274 
   274 
   275 
   275 
   276 class InstanceTagName:
   276 class InstanceTagName(object):
   277     """Helpers object for generating instance tagname"""
   277     """Helpers object for generating instance tagname"""
   278 
   278 
   279     def __init__(self, controller):
   279     def __init__(self, controller):
   280         self.Controller = controller
   280         self.Controller = controller
   281         self.TagName = None
   281         self.TagName = None
   385 
   385 
   386     def copy(self):
   386     def copy(self):
   387         return _ActionInfos(*[getattr(self, attr) for attr in self.__slots__])
   387         return _ActionInfos(*[getattr(self, attr) for attr in self.__slots__])
   388 
   388 
   389 
   389 
   390 class BlockInstanceFactory:
   390 class BlockInstanceFactory(object):
   391 
   391 
   392     def __init__(self, block_instances):
   392     def __init__(self, block_instances):
   393         self.BlockInstances = block_instances
   393         self.BlockInstances = block_instances
   394         self.CurrentInstance = None
   394         self.CurrentInstance = None
   395         self.SpecificValues = None
   395         self.SpecificValues = None
   459 
   459 
   460 # Length of the buffer
   460 # Length of the buffer
   461 UNDO_BUFFER_LENGTH = 20
   461 UNDO_BUFFER_LENGTH = 20
   462 
   462 
   463 
   463 
   464 class UndoBuffer:
   464 class UndoBuffer(object):
   465     """
   465     """
   466     Undo Buffer for PLCOpenEditor
   466     Undo Buffer for PLCOpenEditor
   467     Class implementing a buffer of changes made on the current editing model
   467     Class implementing a buffer of changes made on the current editing model
   468     """
   468     """
   469 
   469 
   542     # Return True if current state is saved
   542     # Return True if current state is saved
   543     def IsCurrentSaved(self):
   543     def IsCurrentSaved(self):
   544         return self.LastSave == self.CurrentIndex
   544         return self.LastSave == self.CurrentIndex
   545 
   545 
   546 
   546 
   547 class PLCControler:
   547 class PLCControler(object):
   548     """
   548     """
   549     Controler for PLCOpenEditor
   549     Controler for PLCOpenEditor
   550     Class which controls the operations made on the plcopen model and answers to view requests
   550     Class which controls the operations made on the plcopen model and answers to view requests
   551     """
   551     """
   552 
   552