Add doubleBuffering to Displays to eliminate flicker

This commit is contained in:
cncfanatics
2010-11-19 09:50:03 +01:00
parent d5be272403
commit 475aab1a4d

View File

@@ -23,9 +23,11 @@ from gui.viewColumn import ViewColumn
import sys
class Display(wx.ListCtrl):
def __init__(self, parent, size = wx.DefaultSize, style = 0):
def __init__(self, parent, size = wx.DefaultSize, style = 0, doubleBuffered = True):
wx.ListCtrl.__init__(self, parent,size = size, style=wx.LC_REPORT | ( style | wx.BORDER_NONE if not (style & wx.SIMPLE_BORDER) else style) )
self.SetDoubleBuffered(doubleBuffered)
self.imageList = wx.ImageList(16, 16)
self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL)
self.activeColumns = []
@@ -137,6 +139,7 @@ class Display(wx.ListCtrl):
if stuff == None:
return
self.Freeze()
selection = []
sel = self.GetFirstSelected()
while sel != -1:
@@ -162,12 +165,9 @@ class Display(wx.ListCtrl):
if oldText != newText or oldImageId != newImageId:
self.SetItem(colItem)
self.SetItemState(item, 0 , wx.LIST_STATE_FOCUSED | wx.LIST_STATE_SELECTED)
self.SetItemData(item, id)
self.SetItemState(item, 0 , wx.LIST_STATE_FOCUSED | wx.LIST_STATE_SELECTED)
self.SetItemData(item, id)
self.Freeze()
if 'wxMSW' in wx.PlatformInfo:
for i,col in enumerate(self.activeColumns):
if not col.resized: