Fix bug when modifying slave position
authorLaurent Bessard
Sun, 23 Sep 2012 23:52:47 +0200
changeset 2080 6d0d94cd0fe0
parent 2079 49242019a9ca
child 2081 b1801bf4365c
Fix bug when modifying slave position
etherlab/etherlab.py
--- a/etherlab/etherlab.py	Sun Sep 23 23:25:57 2012 +0200
+++ b/etherlab/etherlab.py	Sun Sep 23 23:52:47 2012 +0200
@@ -123,12 +123,14 @@
             self.CTNParent.SetSlaveAlias(position, value)
             return value, True
         
+        value, refresh = ConfigTreeNode.SetParamsAttribute(self, path, value)
+        
         # Filter IEC_Channel, Slave_Type and Alias that have specific behavior
-        if path == "BaseParams.IEC_Channel":
+        if path == "BaseParams.IEC_Channel" and value != position:
             self.CTNParent.SetSlavePosition(position, value)
         
-        return ConfigTreeNode.SetParamsAttribute(self, path, value)
-    
+        return value, refresh
+        
     def GetSlaveInfos(self):
         return self.CTNParent.GetSlaveInfos(self.GetSlavePos())