etherlab/etherlab.py
changeset 2037 d54036f70390
parent 2034 ae8fecf082a1
child 2038 6f78c4ac22f9
--- a/etherlab/etherlab.py	Thu Feb 23 23:34:40 2012 +0100
+++ b/etherlab/etherlab.py	Wed Feb 29 12:00:20 2012 +0100
@@ -64,7 +64,10 @@
         """
         @return:  Tupple containing plugin IEC location of current plugin : %I0.0.4.5 => (0,0,4,5)
         """
-        return self.PlugParent.GetCurrentLocation() + (self.BaseParams.getIEC_Channel(), 0)
+        return self.PlugParent.GetCurrentLocation() + self.GetSlavePos()
+
+    def GetSlavePos(self):
+        return self.BaseParams.getIEC_Channel(), 0
 
     def GetSlaveTypeInfos(self):
         slave_type = self.EtherlabDS402Slave.getNode_Type()
@@ -312,7 +315,7 @@
     def AddSlave(self):
         slaves = self.GetSlaves()
         for PlugInstance in self.IterChilds():
-            slaves.append((PlugInstance.BaseParams.getIEC_Channel(), 0))
+            slaves.append(PlugInstance.GetSlavePos())
         slaves.sort()
         if len(slaves) > 0:
             new_pos = (slaves[-1][0] + 1, 0)
@@ -422,7 +425,7 @@
                                      "type": var_class,
                                      "size": var_size,
                                      "IEC_type": entry["Type"],
-                                     "var_name": "%s_%4.4x_%2.2x" % (type_infos["device_type"], index, subindex),
+                                     "var_name": "%s_%4.4x_%2.2x" % ("_".join(type_infos["device_type"].split()), index, subindex),
                                      "location": "%s%s%s"%(var_dir, var_size, ".".join(map(str, current_location + 
                                                                                                 (index, subindex)))),
                                      "description": "",