Commit 60e9a00d authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Better default colours for widgetgrid

parent bfe98b52
......@@ -103,30 +103,40 @@ class WidgetGrid(wx.ScrolledWindow):
"""
_defaultBorderColour = '#000000'
_defaultBorderColour = None
"""The colour of border a border which is shown around every cell in the
grid.
grid. Initialised in :meth:`__init__`.
"""
_defaultOddColour = '#ffffff'
"""Background colour for cells on odd rows."""
_defaultOddColour = None
"""Background colour for cells on odd rows.
Initialised in :meth:`__init__`.
"""
_defaultEvenColour = '#eeeeee'
"""Background colour for cells on even rows."""
_defaultEvenColour = None
"""Background colour for cells on even rows.
Initialised in :meth:`__init__`.
"""
_defaultLabelColour = '#dddddd'
"""Background colour for row and column labels."""
_defaultLabelColour = None
"""Background colour for row and column labels.
Initialised in :meth:`__init__`.
"""
_defaultSelectedColour = '#cdcdff'
"""Background colour for selected cells. """
_defaultSelectedColour = None
"""Background colour for selected cells.
Initialised in :meth:`__init__`.
"""
_defaultDragColour = '#ffcdcd'
"""Background colour for columns being dragged. """
_defaultDragColour = None
"""Background colour for columns being dragged.
Initialised in :meth:`__init__`.
"""
def __init__(self, parent, style=None):
......@@ -140,6 +150,27 @@ class WidgetGrid(wx.ScrolledWindow):
and :data:`WG_DRAGGABLE_COLUMNS`.
"""
border = wx.SystemSettings.GetColour(wx.SYS_COLOUR_ACTIVEBORDER)
odd = wx.SystemSettings.GetColour(wx.SYS_COLOUR_LISTBOX)
even = wx.SystemSettings.GetColour(wx.SYS_COLOUR_LISTBOX)\
.ChangeLightness(75)
label = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
select = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)
drag = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)
if WidgetGrid._defaultBorderColour is None:
WidgetGrid._defaultBorderColour = border
if WidgetGrid._defaultOddColour is None:
WidgetGrid._defaultOddColour = odd
if WidgetGrid._defaultEvenColour is None:
WidgetGrid._defaultEvenColour = even
if WidgetGrid._defaultLabelColour is None:
WidgetGrid._defaultLabelColour = label
if WidgetGrid._defaultSelectedColour is None:
WidgetGrid._defaultSelecteddColour = select
if WidgetGrid._defaultDragColour is None:
WidgetGrid._defaultDragColour = drag
if style is None:
style = wx.HSCROLL | wx.VSCROLL
......@@ -1243,7 +1274,6 @@ class WidgetGrid(wx.ScrolledWindow):
container = self.__widgets[ row][col]
widget = self.__widgetRefs[row][col]
self.__setBackgroundColour(container, colour)
self.__setBackgroundColour(widget, colour)
widget .Refresh()
container.Refresh()
......
......@@ -77,8 +77,7 @@ class WidgetList(scrolledpanel.ScrolledPanel):
"""
odd = wx.SystemSettings.GetColour(wx.SYS_COLOUR_LISTBOX)
even = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)\
.ChangeLightness(75)
even = odd.ChangeLightness(75)
group = odd
if WidgetList._defaultOddColour is None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment