Ejemplo n.º 1
0
class TestFastObjectListView(TestObjectListView):
    def setUp(self):
        super(TestFastObjectListView, self).setUp()

        panel = wx.Panel(self.frame, -1)
        self.objectListView = FastObjectListView(panel,
                                                 -1,
                                                 style=wx.LC_REPORT
                                                 | wx.SUNKEN_BORDER)
        sizerPanel = wx.BoxSizer(wx.VERTICAL)
        sizerPanel.Add(self.objectListView, 1, wx.ALL | wx.EXPAND, 4)
        panel.SetSizer(sizerPanel)

        sizerFrame = wx.BoxSizer(wx.VERTICAL)
        sizerFrame.Add(panel, 1, wx.ALL | wx.EXPAND, 4)
        self.frame.SetSizer(sizerFrame)

        loadOLV(self.objectListView)

    #-------------------------------------------------------------------------
    # Override inherited tests

    def getBackgroundColour(self, i):
        # There is no direct way to get the background colour of an item in a virtual
        # list, so we have to cheat by approximating the process of building a
        # list item
        attr = self.objectListView.OnGetItemAttr(i)
        if attr is None or not attr.HasBackgroundColour():
            # this returns an invalid color
            return self.objectListView.GetItemBackgroundColour(i)
        else:
            return attr.GetBackgroundColour()