Adding drag'n drop of debug variable from DebugVariable grid and PouInstance variable list
authorLaurent Bessard
Tue, 11 Dec 2012 01:19:42 +0100
changeset 898 6b2958f04f30
parent 897 3cd39bc7dbad
child 899 64aa66d481c5
Adding drag'n drop of debug variable from DebugVariable grid and PouInstance variable list
controls/DebugVariablePanel.py
controls/PouInstanceVariablesPanel.py
--- a/controls/DebugVariablePanel.py	Tue Dec 11 01:17:52 2012 +0100
+++ b/controls/DebugVariablePanel.py	Tue Dec 11 01:19:42 2012 +0100
@@ -457,7 +457,7 @@
     def OnVariablesGridCellLeftClick(self, event):
         if event.GetCol() == 0:
             row = event.GetRow()
-            data = wx.TextDataObject(str(self.Table.GetValueByName(row, "Variable")))
+            data = wx.TextDataObject(str((self.Table.GetValueByName(row, "Variable"), "debug")))
             dragSource = wx.DropSource(self.VariablesGrid)
             dragSource.SetData(data)
             dragSource.DoDragDrop()
--- a/controls/PouInstanceVariablesPanel.py	Tue Dec 11 01:17:52 2012 +0100
+++ b/controls/PouInstanceVariablesPanel.py	Tue Dec 11 01:19:42 2012 +0100
@@ -329,6 +329,17 @@
     def OnVariablesListLeftDown(self, event):
         if self.InstanceChoice.GetSelection() == -1:
             wx.CallAfter(self.ShowInstanceChoicePopup)
+        else:
+            instance_path = self.InstanceChoice.GetStringSelection()
+            item, flags = self.VariablesList.HitTest(event.GetPosition())
+            if item is not None and flags & CT.TREE_HITTEST_ONITEMLABEL:
+                item_infos = self.VariablesList.GetPyData(item)
+                if item_infos is not None and item_infos["class"] in ITEMS_VARIABLE:
+                    item_path = "%s.%s" % (instance_path, item_infos["name"])
+                    data = wx.TextDataObject(str((item_path, "debug")))
+                    dragSource = wx.DropSource(self.VariablesList)
+                    dragSource.SetData(data)
+                    dragSource.DoDragDrop()
         event.Skip()
         
     def OnInstanceChoiceLeftDown(self, event):