From ac0f578a01e4e4fc9c1e50a349a154367217d05d Mon Sep 17 00:00:00 2001 From: cbeytas Date: Mon, 7 Jan 2019 00:12:00 -0500 Subject: [PATCH] Fix CustomTreeCtrl/HyperTreeList background color CustomTreeCtrl and HyperTreeList use wx.SYS_COLOUR_LISTBOX for their default background colors. This defaults to dank Grey on MSW/GTK/MacOS even though the TreeCtrl and ListCtrl on all three platforms default to a white background. Use a trick from UltimateListCtrl to take default colors from wx.ListCtrl. This can be seen in the demos, except that the CustomTreeCtrl demo forces its background to wx.WHITE. With these changes forcing the background color is no longer necessary and allows the controls to take on the native background color for themes that change it. --- demo/agw/CustomTreeCtrl.py | 2 -- demo/agw/HyperTreeList.py | 2 +- wx/lib/agw/customtreectrl.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/demo/agw/CustomTreeCtrl.py b/demo/agw/CustomTreeCtrl.py index b52dce63..44aaffc5 100644 --- a/demo/agw/CustomTreeCtrl.py +++ b/demo/agw/CustomTreeCtrl.py @@ -1293,8 +1293,6 @@ class CustomTreeCtrl(CT.CustomTreeCtrl): CT.CustomTreeCtrl.__init__(self, parent, id, pos, size, style, agwStyle) - self.SetBackgroundColour(wx.WHITE) - alldata = dir(CT) treestyles = [] diff --git a/demo/agw/HyperTreeList.py b/demo/agw/HyperTreeList.py index 5f46b35d..f795e72c 100644 --- a/demo/agw/HyperTreeList.py +++ b/demo/agw/HyperTreeList.py @@ -1052,7 +1052,7 @@ class HyperTreeListDemo(wx.Frame): splitter.SplitVertically(self.leftpanel, panel, 300) splitter.SetMinimumPaneSize(120) - self.leftpanel.SetBackgroundColour(wx.WHITE) + #self.leftpanel.SetBackgroundColour(wx.WHITE) self.leftpanel.SetScrollRate(20, 20) self.Fit() diff --git a/wx/lib/agw/customtreectrl.py b/wx/lib/agw/customtreectrl.py index 5f996a5c..943395bf 100644 --- a/wx/lib/agw/customtreectrl.py +++ b/wx/lib/agw/customtreectrl.py @@ -2969,7 +2969,7 @@ class CustomTreeCtrl(wx.ScrolledWindow): self.SetValidator(validator) - attr = self.GetDefaultAttributes() + attr = wx.ListCtrl.GetClassDefaultAttributes() self.SetOwnForegroundColour(attr.colFg) self.SetOwnBackgroundColour(attr.colBg)