Merge with Donggu modifications
authorlaurent
Tue, 10 Jan 2012 15:11:22 +0100
changeset 2028 5132c497918c
parent 2027 e579bd6faa87 (diff)
parent 2025 87f428326f9b (current diff)
child 2029 7c848efa21c6
Merge with Donggu modifications
etherlab/plc_etherlab.c
--- a/etherlab/ConfigEditor.py	Thu Dec 22 14:52:18 2011 +0900
+++ b/etherlab/ConfigEditor.py	Tue Jan 10 15:11:22 2012 +0100
@@ -1,4 +1,5 @@
 import wx
+import wx.grid
 
 from controls import CustomGrid, CustomTable, EditorPanel
 
@@ -323,9 +324,6 @@
         
         self.RefreshView()
     
-    def __del__(self):
-        self.Controler.OnCloseEditor()
-    
     def GetSlaveTitle(self):
         type_infos = self.Controler.GetSlaveType(self.Slave)
         return "%s (%d:%d)" % (type_infos["device_type"], self.Slave[0], self.Slave[1])
@@ -469,7 +467,10 @@
         
         img = wx.Bitmap(self.Controler.GetIconPath("Cfile.png"), wx.BITMAP_TYPE_PNG).ConvertToImage()
         self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16)))
-        
+    
+    def __del__(self):
+        self.Controler.OnCloseEditor()
+    
     def GetTitle(self):
         fullname = self.Controler.PlugFullName()
         if not self.Controler.ConfigIsSaved():
--- a/etherlab/etherlab.py	Thu Dec 22 14:52:18 2011 +0900
+++ b/etherlab/etherlab.py	Tue Jan 10 15:11:22 2012 +0100
@@ -239,10 +239,13 @@
                             else:
                                 var_dir = "%Q"    
                             
-                            vars.append({"name": "%s - %s" % (ExtractName(pdo.getName()), ExtractName(entry.getName())),
+                            pdo_name = ExtractName(pdo.getName())
+                            entry_name = ExtractName(entry.getName())
+                            vars.append({"name": "%s - %s" % (pdo_name, entry_name),
                                          "type": var_class,
                                          "size": var_size,
                                          "IEC_type": var_type,
+                                         "var_name": "%s_%s" % (type_infos["device_type"], "_".join(pdo_name.split())),
                                          "location": "%s%s%s"%(var_dir, var_size, ".".join(map(str, current_location + 
                                                                                                     slave_pos + 
                                                                                                     (index, subindex)))),
--- a/etherlab/plc_etherlab.c	Thu Dec 22 14:52:18 2011 +0900
+++ b/etherlab/plc_etherlab.c	Tue Jan 10 15:11:22 2012 +0100
@@ -100,6 +100,7 @@
 	if (rt_fd >= 0) {
 		rt_dev_close(rt_fd);
 	}
+	//release master
 	ecrt_release_master(master);
 }