controls/DebugVariablePanel/DebugVariableTextViewer.py
changeset 2437 105c20fdeb19
parent 1878 fb73a6b6622d
child 2450 5024c19ca8f0
equal deleted inserted replaced
2436:82bfc75bcd9d 2437:105c20fdeb19
    22 # along with this program; if not, write to the Free Software
    22 # along with this program; if not, write to the Free Software
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    24 
    24 
    25 
    25 
    26 from __future__ import absolute_import
    26 from __future__ import absolute_import
       
    27 from __future__ import division
    27 from types import TupleType
    28 from types import TupleType
    28 
    29 
    29 import wx
    30 import wx
    30 
    31 
    31 from controls.DebugVariablePanel.DebugVariableViewer import DebugVariableViewer
    32 from controls.DebugVariablePanel.DebugVariableViewer import DebugVariableViewer
   102 
   103 
   103             # Get Before which Viewer the variable has to be moved or added
   104             # Get Before which Viewer the variable has to be moved or added
   104             # according to the position of mouse in Viewer.
   105             # according to the position of mouse in Viewer.
   105             _width, height = self.ParentControl.GetSize()
   106             _width, height = self.ParentControl.GetSize()
   106             target_idx = self.ParentControl.GetIndex()
   107             target_idx = self.ParentControl.GetIndex()
   107             if y > height / 2:
   108             if y > height // 2:
   108                 target_idx += 1
   109                 target_idx += 1
   109 
   110 
   110             # Drag'n Drop is an internal is an internal move inside Debug
   111             # Drag'n Drop is an internal is an internal move inside Debug
   111             # Variable Panel
   112             # Variable Panel
   112             if len(values) > 2 and values[2] == "move":
   113             if len(values) > 2 and values[2] == "move":
   207         item_path = item.GetVariable(
   208         item_path = item.GetVariable(
   208             self.ParentWindow.GetVariableNameMask())
   209             self.ParentWindow.GetVariableNameMask())
   209 
   210 
   210         # Draw item variable path at Viewer left side
   211         # Draw item variable path at Viewer left side
   211         w, h = gc.GetTextExtent(item_path)
   212         w, h = gc.GetTextExtent(item_path)
   212         gc.DrawText(item_path, 20, (height - h) / 2)
   213         gc.DrawText(item_path, 20, (height - h) // 2)
   213 
   214 
   214         # Update 'Release' button state and text color according to item forced
   215         # Update 'Release' button state and text color according to item forced
   215         # flag value
   216         # flag value
   216         item_forced = item.IsForced()
   217         item_forced = item.IsForced()
   217         self.Buttons[1].Enable(item_forced)
   218         self.Buttons[1].Enable(item_forced)
   220             gc.SetTextForeground(wx.BLUE)
   221             gc.SetTextForeground(wx.BLUE)
   221 
   222 
   222         # Draw item current value at right side of Viewer
   223         # Draw item current value at right side of Viewer
   223         item_value = item.GetValue()
   224         item_value = item.GetValue()
   224         w, h = gc.GetTextExtent(item_value)
   225         w, h = gc.GetTextExtent(item_value)
   225         gc.DrawText(item_value, width - 40 - w, (height - h) / 2)
   226         gc.DrawText(item_value, width - 40 - w, (height - h) // 2)
   226 
   227 
   227         # Draw other Viewer common elements
   228         # Draw other Viewer common elements
   228         self.DrawCommonElements(gc)
   229         self.DrawCommonElements(gc)
   229 
   230 
   230         gc.EndDrawing()
   231         gc.EndDrawing()