controls/DebugVariablePanel/DebugVariableTextViewer.py
branchwxPython4
changeset 3303 0ffb41625592
parent 2742 5f7445b582d4
child 3660 0e41dbe6ddcd
equal deleted inserted replaced
3302:c89fc366bebd 3303:0ffb41625592
   193         Redraw content displayed by Viewer
   193         Redraw content displayed by Viewer
   194         """
   194         """
   195 
   195 
   196         # Create buffered DC for drawing in panel
   196         # Create buffered DC for drawing in panel
   197         width, height = self.GetSize()
   197         width, height = self.GetSize()
   198         bitmap = wx.EmptyBitmap(width, height)
   198         bitmap = wx.Bitmap(width, height)
   199         dc = wx.BufferedDC(wx.PaintDC(self), bitmap)
   199         dc = wx.BufferedDC(wx.PaintDC(self), bitmap)
   200         dc.Clear()
   200         dc.Clear()
   201 
   201 
   202         # Get Graphics Context for DC, for anti-aliased and transparent
   202         # Get Graphics Context for DC, for anti-aliased and transparent
   203         # rendering
   203         # rendering
   204         gc = wx.GCDC(dc)
   204         gc = wx.GCDC(dc)
   205 
       
   206         gc.BeginDrawing()
       
   207 
   205 
   208         # Get first item
   206         # Get first item
   209         item = self.ItemsDict.values()[0]
   207         item = self.ItemsDict.values()[0]
   210 
   208 
   211         # Get item variable path masked according Debug Variable Panel mask
   209         # Get item variable path masked according Debug Variable Panel mask
   230         gc.DrawText(item_value, width - 40 - w, (height - h) // 2)
   228         gc.DrawText(item_value, width - 40 - w, (height - h) // 2)
   231 
   229 
   232         # Draw other Viewer common elements
   230         # Draw other Viewer common elements
   233         self.DrawCommonElements(gc)
   231         self.DrawCommonElements(gc)
   234 
   232 
   235         gc.EndDrawing()
       
   236 
       
   237     def OnLeftDown(self, event):
   233     def OnLeftDown(self, event):
   238         """
   234         """
   239         Function called when mouse left button is pressed
   235         Function called when mouse left button is pressed
   240         @param event: wx.MouseEvent
   236         @param event: wx.MouseEvent
   241         """
   237         """
   250 
   246 
   251         # Test if mouse has been pressed in this bounding box. In that case
   247         # Test if mouse has been pressed in this bounding box. In that case
   252         # start a move drag'n drop of item variable
   248         # start a move drag'n drop of item variable
   253         x, y = event.GetPosition()
   249         x, y = event.GetPosition()
   254         item_path_bbox = wx.Rect(20, (height - h) / 2, w, h)
   250         item_path_bbox = wx.Rect(20, (height - h) / 2, w, h)
   255         if item_path_bbox.InsideXY(x, y):
   251         if item_path_bbox.Contains(x, y):
   256             self.ShowButtons(False)
   252             self.ShowButtons(False)
   257             data = wx.TextDataObject(str((item.GetVariable(), "debug", "move")))
   253             data = wx.TextDataObject(str((item.GetVariable(), "debug", "move")))
   258             dragSource = wx.DropSource(self)
   254             dragSource = wx.DropSource(self)
   259             dragSource.SetData(data)
   255             dragSource.SetData(data)
   260             dragSource.DoDragDrop()
   256             dragSource.DoDragDrop()