ConfigTreeNode.py
changeset 1782 5b6ad7a7fd9d
parent 1778 1c6a704bd39c
child 1828 396da88d7b5c
equal deleted inserted replaced
1781:b112bfdde5cc 1782:5b6ad7a7fd9d
   140 
   140 
   141     def RemoteExec(self, script, **kwargs):
   141     def RemoteExec(self, script, **kwargs):
   142         return self.CTNParent.RemoteExec(script, **kwargs)
   142         return self.CTNParent.RemoteExec(script, **kwargs)
   143 
   143 
   144     def OnCTNSave(self, from_project_path=None):
   144     def OnCTNSave(self, from_project_path=None):
   145         #Default, do nothing and return success
   145         """Default, do nothing and return success"""
   146         return True
   146         return True
   147 
   147 
   148     def GetParamsAttributes(self, path=None):
   148     def GetParamsAttributes(self, path=None):
   149         if path:
   149         if path:
   150             parts = path.split(".", 1)
   150             parts = path.split(".", 1)
   393         @param DesiredName: The desired Name (string)
   393         @param DesiredName: The desired Name (string)
   394         """
   394         """
   395         # Get Current Name
   395         # Get Current Name
   396         CurrentName = self.BaseParams.getName()
   396         CurrentName = self.BaseParams.getName()
   397         # Do nothing if no change
   397         # Do nothing if no change
   398         #if CurrentName == DesiredName: return CurrentName
   398         # if CurrentName == DesiredName: return CurrentName
   399         # Build a list of used Name out of parent's Children
   399         # Build a list of used Name out of parent's Children
   400         AllNames = []
   400         AllNames = []
   401         for CTNInstance in self.CTNParent.IterChildren():
   401         for CTNInstance in self.CTNParent.IterChildren():
   402             if CTNInstance != self:
   402             if CTNInstance != self:
   403                 AllNames.append(CTNInstance.BaseParams.getName())
   403                 AllNames.append(CTNInstance.BaseParams.getName())
   442         @param DesiredChannel: The desired IEC channel (int)
   442         @param DesiredChannel: The desired IEC channel (int)
   443         """
   443         """
   444         # Get Current IEC channel
   444         # Get Current IEC channel
   445         CurrentChannel = self.BaseParams.getIEC_Channel()
   445         CurrentChannel = self.BaseParams.getIEC_Channel()
   446         # Do nothing if no change
   446         # Do nothing if no change
   447         #if CurrentChannel == DesiredChannel: return CurrentChannel
   447         # if CurrentChannel == DesiredChannel: return CurrentChannel
   448         # Build a list of used Channels out of parent's Children
   448         # Build a list of used Channels out of parent's Children
   449         AllChannels = self.GetAllChannels()
   449         AllChannels = self.GetAllChannels()
   450 
   450 
   451         # Now, try to guess the nearest available channel
   451         # Now, try to guess the nearest available channel
   452         res = DesiredChannel
   452         res = DesiredChannel
   509             self.Children.pop(CTNInstance.CTNType)
   509             self.Children.pop(CTNInstance.CTNType)
   510         # Forget it... (View have to refresh)
   510         # Forget it... (View have to refresh)
   511 
   511 
   512     def CTNRemove(self):
   512     def CTNRemove(self):
   513         # Fetch the confnode
   513         # Fetch the confnode
   514         #CTNInstance = self.GetChildByName(CTNName)
   514         # CTNInstance = self.GetChildByName(CTNName)
   515         # Ask to his parent to remove it
   515         # Ask to his parent to remove it
   516         self.CTNParent._doRemoveChild(self)
   516         self.CTNParent._doRemoveChild(self)
   517 
   517 
   518     def CTNAddChild(self, CTNName, CTNType, IEC_Channel=0):
   518     def CTNAddChild(self, CTNName, CTNType, IEC_Channel=0):
   519         """
   519         """