beremiz

Parents f971de6d274f
Children 8eb1186fc9cf
Adding support for updating located variables when changing plugin IEC_Channel
  • +13 -1
    plugger.py
  • --- a/plugger.py Mon Nov 30 10:13:36 2009 +0100
    +++ b/plugger.py Tue Dec 01 10:59:17 2009 +0100
    @@ -174,7 +174,11 @@
    self.ChangesToSave = True
    # Filter IEC_Channel and Name, that have specific behavior
    if path == "BaseParams.IEC_Channel":
    - return self.FindNewIEC_Channel(value), True
    + old_leading = ".".join(map(str, self.GetCurrentLocation()))
    + new_value = self.FindNewIEC_Channel(value)
    + new_leading = ".".join(map(str, self.PlugParent.GetCurrentLocation() + (new_value,)))
    + self.GetPlugRoot().UpdateProjectVariableLocation(old_leading, new_leading)
    + return new_value, True
    elif path == "BaseParams.Name":
    res = self.FindNewName(value)
    self.PlugRequestSave()
    @@ -988,6 +992,14 @@
    self.AppFrame.RefreshLibraryTree()
    self.AppFrame.RefreshEditor()
    + # Update a PLCOpenEditor Pou variable location
    + def UpdateProjectVariableLocation(self, old_leading, new_leading):
    + self.Project.updateElementAddress(old_leading, new_leading)
    + self.BufferProject()
    + if self.AppFrame is not None:
    + self.AppFrame._Refresh(TITLE, INSTANCESTREE, FILEMENU, EDITMENU)
    + self.AppFrame.RefreshEditor()
    +
    def GetVariableLocationTree(self):
    '''
    This function is meant to be overridden by plugins.