# HG changeset patch # User Andrey Skvortsov # Date 1505999211 -10800 # Node ID 1e9a67d68612065c0aee8e3a19fcb28bfb9b3b0e # Parent 1d7bf584eb7f87df2085727f2866718f5f2f9e69 fix commit "lazy initialization of highlight pens and brushes for DebugVariableViewer" (5562f34f) diff -r 1d7bf584eb7f -r 1e9a67d68612 controls/DebugVariablePanel/DebugVariableGraphicViewer.py --- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Sep 21 15:04:15 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py Thu Sep 21 16:06:51 2017 +0300 @@ -1398,15 +1398,15 @@ # If highlight to display is resize, draw thick grey line at bottom # side of canvas if self.Highlight == HIGHLIGHT_RESIZE: - destGC.SetPen(HIGHLIGHT_RESIZE_PEN) - destGC.SetBrush(HIGHLIGHT_RESIZE_BRUSH) + destGC.SetPen(HIGHLIGHT['RESIZE_PEN']) + destGC.SetBrush(HIGHLIGHT['RESIZE_BRUSH']) destGC.DrawRectangle(0, height - 5, width, 5) # If highlight to display is merging graph, draw 50% transparent blue # rectangle on left or right part of figure depending on highlight type elif self.Highlight in [HIGHLIGHT_LEFT, HIGHLIGHT_RIGHT]: - destGC.SetPen(HIGHLIGHT_DROP_PEN) - destGC.SetBrush(HIGHLIGHT_DROP_BRUSH) + destGC.SetPen(HIGHLIGHT['DROP_PEN']) + destGC.SetBrush(HIGHLIGHT['DROP_BRUSH']) x_offset = (bbox.width / 2 if self.Highlight == HIGHLIGHT_RIGHT diff -r 1d7bf584eb7f -r 1e9a67d68612 controls/DebugVariablePanel/DebugVariableViewer.py --- a/controls/DebugVariablePanel/DebugVariableViewer.py Thu Sep 21 15:04:15 2017 +0300 +++ b/controls/DebugVariablePanel/DebugVariableViewer.py Thu Sep 21 16:06:51 2017 +0300 @@ -41,10 +41,8 @@ HIGHLIGHT_RESIZE] = range(6) # Viewer highlight styles -HIGHLIGHT_DROP_PEN = None -HIGHLIGHT_DROP_BRUSH = None -HIGHLIGHT_RESIZE_PEN = None -HIGHLIGHT_RESIZE_BRUSH = None +HIGHLIGHT = { +} # ------------------------------------------------------------------------------- # Base Debug Variable Viewer Class @@ -85,11 +83,12 @@ """ Init global pens and brushes """ - if HIGHLIGHT_DROP_PEN is None: - HIGHLIGHT_DROP_PEN = wx.Pen(wx.Colour(0, 128, 255)) - HIGHLIGHT_DROP_BRUSH = wx.Brush(wx.Colour(0, 128, 255, 128)) - HIGHLIGHT_RESIZE_PEN = wx.Pen(wx.Colour(200, 200, 200)) - HIGHLIGHT_RESIZE_BRUSH = wx.Brush(wx.Colour(200, 200, 200)) + global HIGHLIGHT + if not HIGHLIGHT: + HIGHLIGHT['DROP_PEN'] = wx.Pen(wx.Colour(0, 128, 255)) + HIGHLIGHT['DROP_BRUSH'] = wx.Brush(wx.Colour(0, 128, 255, 128)) + HIGHLIGHT['RESIZE_PEN'] = wx.Pen(wx.Colour(200, 200, 200)) + HIGHLIGHT['RESIZE_BRUSH'] = wx.Brush(wx.Colour(200, 200, 200)) def GetIndex(self): """ @@ -281,8 +280,8 @@ width, height = self.GetSize() # Set dc styling for drop before or drop after highlight - dc.SetPen(HIGHLIGHT_DROP_PEN) - dc.SetBrush(HIGHLIGHT_DROP_BRUSH) + dc.SetPen(HIGHLIGHT['DROP_PEN']) + dc.SetBrush(HIGHLIGHT['DROP_BRUSH']) # Draw line at upper side of Viewer if highlight is drop before if self.Highlight == HIGHLIGHT_BEFORE: