Fix bug with representation of string variable value in DebugVariablePanel
authorLaurent Bessard
Mon, 03 Dec 2012 23:38:23 +0100
changeset 892 771581a6b0be
parent 891 39f355a535d8
child 893 f528c421637b
Fix bug with representation of string variable value in DebugVariablePanel
controls/DebugVariablePanel.py
--- a/controls/DebugVariablePanel.py	Mon Dec 03 12:33:21 2012 +0100
+++ b/controls/DebugVariablePanel.py	Mon Dec 03 23:38:23 2012 +0100
@@ -108,6 +108,9 @@
             self.Parent.HasNewData = True
     
     def SetValue(self, value):
+        if (self.VariableType == "STRING" and value.startswith("'") and value.endswith("'") or
+            self.VariableType == "WSTRING" and value.startswith('"') and value.endswith('"')):
+            value = value[1:-1]
         if self.Value != value:
             self.Value = value
             self.Parent.HasNewData = True
@@ -278,6 +281,8 @@
         self.VariablesGrid.SetDropTarget(DebugVariableDropTarget(self))
         self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK, 
               self.OnVariablesGridCellRightClick)
+        self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, 
+              self.OnVariablesGridCellLeftClick)
         self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, 
               self.OnVariablesGridCellChange)
         main_panel_sizer.AddWindow(self.VariablesGrid, flag=wx.GROW)
@@ -356,7 +361,7 @@
             setattr(self.Graphics3DAxes, "_on_move", self.OnGraphics3DMotion)
             
             self.Graphics3DCanvas = FigureCanvas(self.GraphicsPanel, -1, self.Graphics3DFigure)
-            self.Graphics3DCanvas.SetMinSize(wx.Size(0, 0))
+            self.Graphics3DCanvas.SetMinSize(wx.Size(1, 1))
             graphics_panel_sizer.AddWindow(self.Graphics3DCanvas, 1, flag=wx.GROW)
             
             self.Graphics3DAxes.mouse_init()
@@ -449,6 +454,15 @@
             self.ReleaseDataValue(iec_path)
         return ReleaseVariableFunction
     
+    def OnVariablesGridCellLeftClick(self, event):
+        if event.GetCol() == 0:
+            row = event.GetRow()
+            data = wx.TextDataObject(str(self.Table.GetValueByName(row, "Variable")))
+            dragSource = wx.DropSource(self.VariablesGrid)
+            dragSource.SetData(data)
+            dragSource.DoDragDrop()
+        event.Skip()
+    
     def OnVariablesGridCellRightClick(self, event):
         row, col = event.GetRow(), event.GetCol()
         if self.Table.GetColLabelValue(col, False) == "Value":