def RefreshViewer(self):
"""
Method that refresh the content displayed by Viewer
"""
# Create buffered DC for drawing in panel
width, height = self.GetSize()
bitmap = wx.EmptyBitmap(width, height)
dc = wx.BufferedDC(wx.ClientDC(self), bitmap)
dc.Clear()
# Get Graphics Context for DC, for anti-aliased and transparent
# rendering
gc = wx.GCDC(dc)
gc.BeginDrawing()
# Get first item
item = self.ItemsDict.values()[0]
# Get item variable path masked according Debug Variable Panel mask
item_path = item.GetVariable(
self.ParentWindow.GetVariableNameMask())
# Draw item variable path at Viewer left side
w, h = gc.GetTextExtent(item_path)
gc.DrawText(item_path, 20, (height - h) / 2)
# Update 'Release' button state and text color according to item forced
# flag value
item_forced = item.IsForced()
self.Buttons[1].Enable(item_forced)
self.RefreshButtonsPosition()
if item_forced:
gc.SetTextForeground(wx.BLUE)
# Draw item current value at right side of Viewer
item_value = item.GetValue()
w, h = gc.GetTextExtent(item_value)
gc.DrawText(item_value, width - 40 - w, (height - h) / 2)
# Draw other Viewer common elements
self.DrawCommonElements(gc)
gc.EndDrawing()
评论列表
文章目录