# HG changeset patch
# User Laurent Bessard
# Date 1348437167 -7200
# Node ID 6d0d94cd0fe01ccd0d12a10acc68707454aa103b
# Parent  49242019a9ca9a82948ec90bc5c9248d4d105eb2
Fix bug when modifying slave position

diff -r 49242019a9ca -r 6d0d94cd0fe0 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())