Reduced flicker on LogViewer and DebugGraphPanel on Windows
authorLaurent Bessard
Fri, 15 Mar 2013 12:49:15 +0100
changeset 988 30e7571c10d0
parent 987 7ca88194ae89
child 989 b24c11c93766
Reduced flicker on LogViewer and DebugGraphPanel on Windows
controls/DebugVariablePanel.py
controls/LogViewer.py
--- a/controls/DebugVariablePanel.py	Fri Mar 15 12:07:39 2013 +0100
+++ b/controls/DebugVariablePanel.py	Fri Mar 15 12:49:15 2013 +0100
@@ -690,6 +690,9 @@
             else:
                 self.SetHighlight(HIGHLIGHT_AFTER)
         
+        def OnEraseBackground(self, event):
+            pass
+        
         def OnResize(self, event):
             wx.CallAfter(self.RefreshButtonsState, True)
             event.Skip()
@@ -720,6 +723,7 @@
             self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter)
             self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
             self.Bind(wx.EVT_SIZE, self.OnResize)
+            self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
             self.Bind(wx.EVT_PAINT, self.OnPaint)
             
             self.SetMinSize(wx.Size(0, 25))
@@ -808,6 +812,7 @@
             self.SetBackgroundColour(wx.WHITE)
             self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter)
             self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
+            self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
             self.Bind(wx.EVT_SIZE, self.OnResize)
             
             self.SetMinSize(wx.Size(200, 200))
@@ -1502,6 +1507,8 @@
             self.GraphicsWindow = wx.ScrolledWindow(self, style=wx.HSCROLL|wx.VSCROLL)
             self.GraphicsWindow.SetBackgroundColour(wx.WHITE)
             self.GraphicsWindow.SetDropTarget(DebugVariableDropTarget(self))
+            self.GraphicsWindow.Bind(wx.EVT_ERASE_BACKGROUND, self.OnGraphicsWindowEraseBackground)
+            self.GraphicsWindow.Bind(wx.EVT_PAINT, self.OnGraphicsWindowPaint)
             self.GraphicsWindow.Bind(wx.EVT_SIZE, self.OnGraphicsWindowResize)
             main_sizer.AddWindow(self.GraphicsWindow, 1, flag=wx.GROW)
             
@@ -2219,6 +2226,14 @@
         self.GraphicsWindow.SetScrollbars(SCROLLBAR_UNIT, SCROLLBAR_UNIT, 
                 vwidth / SCROLLBAR_UNIT, vheight / SCROLLBAR_UNIT, posx, posy)
     
+    def OnGraphicsWindowEraseBackground(self, event):
+        pass
+    
+    def OnGraphicsWindowPaint(self, event):
+        self.RefreshView()
+        event.Skip()
+    
     def OnGraphicsWindowResize(self, event):
         self.RefreshGraphicsWindowScrollbars()
         event.Skip()
+    
\ No newline at end of file
--- a/controls/LogViewer.py	Fri Mar 15 12:07:39 2013 +0100
+++ b/controls/LogViewer.py	Fri Mar 15 12:49:15 2013 +0100
@@ -51,6 +51,7 @@
         self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
         self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
         self.Bind(wx.EVT_MOTION, self.OnMotion)
+        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
         self.Bind(wx.EVT_PAINT, self.OnPaint)
         self.Bind(wx.EVT_SIZE, self.OnResize)
         
@@ -124,6 +125,9 @@
         self.Refresh()
         event.Skip()
     
+    def OnEraseBackground(self, event):
+        pass
+    
     def OnPaint(self, event):
         dc = wx.BufferedPaintDC(self)
         dc.Clear()
@@ -316,6 +320,7 @@
         self.MessagePanel.Bind(wx.EVT_LEFT_UP, self.OnMessagePanelLeftUp)
         self.MessagePanel.Bind(wx.EVT_LEFT_DCLICK, self.OnMessagePanelLeftDCLick)
         self.MessagePanel.Bind(wx.EVT_MOUSEWHEEL, self.OnMessagePanelMouseWheel)
+        self.MessagePanel.Bind(wx.EVT_ERASE_BACKGROUND, self.OnMessagePanelEraseBackground)
         self.MessagePanel.Bind(wx.EVT_PAINT, self.OnMessagePanelPaint)
         self.MessagePanel.Bind(wx.EVT_SIZE, self.OnMessagePanelResize)
         message_panel_sizer.AddWindow(self.MessagePanel, flag=wx.GROW)
@@ -631,6 +636,9 @@
         self.ScrollMessagePanel(event.GetWheelRotation() / event.GetWheelDelta())
         event.Skip()
     
+    def OnMessagePanelEraseBackground(self, event):
+        pass
+    
     def OnMessagePanelPaint(self, event):
         self.RefreshView()
         event.Skip()