Adding support for drag'n dropping located variables from topology panel to configurations and resources variable panel for declaring global located variables
authorlaurent
Sun, 08 Jan 2012 19:05:05 +0100
changeset 2026 65ecbfe9a6f9
parent 2023 f9f884cf3033
child 2027 e579bd6faa87
Adding support for drag'n dropping located variables from topology panel to configurations and resources variable panel for declaring global located variables
etherlab/ConfigEditor.py
etherlab/etherlab.py
--- a/etherlab/ConfigEditor.py	Tue Dec 20 23:43:27 2011 +0100
+++ b/etherlab/ConfigEditor.py	Sun Jan 08 19:05:05 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	Tue Dec 20 23:43:27 2011 +0100
+++ b/etherlab/etherlab.py	Sun Jan 08 19:05:05 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)))),