From ad6864aa464e374426333bd4cc876a9358e4c4aa Mon Sep 17 00:00:00 2001 From: Paul McCarthy Date: Fri, 8 Oct 2021 13:13:07 +0100 Subject: [PATCH 1/2] MNT: Remove legacy macOS logic, and use wx.SystemSettings to select default theme colours --- wx/lib/agw/aui/aui_utilities.py | 26 +------------------------- wx/lib/agw/aui/tabart.py | 28 +++------------------------- 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/wx/lib/agw/aui/aui_utilities.py b/wx/lib/agw/aui/aui_utilities.py index 3df7b4ed..77b30463 100644 --- a/wx/lib/agw/aui/aui_utilities.py +++ b/wx/lib/agw/aui/aui_utilities.py @@ -26,15 +26,6 @@ import wx from .aui_constants import * -if wx.Platform == "__WXMAC__": - try: - import Carbon.Appearance - except ImportError: - CARBON = False - else: - CARBON = True - - def BlendColour(fg, bg, alpha): """ Blends the two colour component `fg` and `bg` into one colour component, adding @@ -183,18 +174,7 @@ def GetBaseColour(): mimicking as closely as possible the platform UI colours. """ - if wx.Platform == "__WXMAC__": - k = Carbon.Appearance.kThemeBrushToolbarBackground if CARBON else 52 - if hasattr(wx, 'MacThemeColour'): - base_colour = wx.MacThemeColour(k) - else: - brush = wx.Brush(wx.BLACK) - brush.MacSetTheme(k) - base_colour = brush.GetColour() - - else: - - base_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE) + base_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE) # the base_colour is too pale to use as our base colour, # so darken it a bit @@ -666,7 +646,3 @@ def CopyAttributes(newArt, oldArt): setattr(newArt, attr, getattr(oldArt, attr)) return newArt - - - - diff --git a/wx/lib/agw/aui/tabart.py b/wx/lib/agw/aui/tabart.py index ebabf42d..dd33c099 100644 --- a/wx/lib/agw/aui/tabart.py +++ b/wx/lib/agw/aui/tabart.py @@ -30,13 +30,6 @@ __date__ = "31 March 2009" import wx -if wx.Platform == '__WXMAC__': - try: - import Carbon.Appearance - except ImportError: - CARBON = False - else: - CARBON = True from .aui_utilities import BitmapFromBits, StepColour, IndentPressedBitmap, ChopText from .aui_utilities import GetBaseColour, DrawMACCloseButton, LightColour, TakeScreenShot @@ -158,22 +151,9 @@ class AuiDefaultTabArt(object): self._active_windowlist_bmp = BitmapFromBits(nb_list_bits, 16, 16, active_colour) self._disabled_windowlist_bmp = BitmapFromBits(nb_list_bits, 16, 16, disabled_colour) - if wx.Platform == "__WXMAC__": - k = Carbon.Appearance.kThemeBrushFocusHighlight if CARBON else 19 - # Get proper highlight colour for focus rectangle from the - # current Mac theme. kThemeBrushFocusHighlight is - # available on Mac OS 8.5 and higher - if hasattr(wx, 'MacThemeColour'): - c = wx.MacThemeColour(k) - else: - brush = wx.Brush(active_colour) - brush.MacSetTheme(k) - c = brush.GetColour() - self._focusPen = wx.Pen(c, 2, wx.PENSTYLE_SOLID) - else: - self._focusPen = wx.Pen(active_colour, 1, wx.PENSTYLE_USER_DASH) - self._focusPen.SetDashes([1, 1]) - self._focusPen.SetCap(wx.CAP_BUTT) + self._focusPen = wx.Pen(active_colour, 1, wx.PENSTYLE_USER_DASH) + self._focusPen.SetDashes([1, 1]) + self._focusPen.SetCap(wx.CAP_BUTT) def SetBaseColour(self, base_colour): @@ -2767,5 +2747,3 @@ class ChromeTabArt(AuiDefaultTabArt): dc.DestroyClippingRegion() return out_tab_rect, out_button_rect, x_extent - - From 12d8462bc28753e79f90e7db46c89e7645a8b396 Mon Sep 17 00:00:00 2001 From: Paul McCarthy Date: Wed, 22 Dec 2021 15:00:41 +0000 Subject: [PATCH 2/2] RF: Don't hard code inactive text colour, use wx.SystemSettings.GetColour instead --- wx/lib/agw/aui/dockart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wx/lib/agw/aui/dockart.py b/wx/lib/agw/aui/dockart.py index d3eb4819..350f0a21 100644 --- a/wx/lib/agw/aui/dockart.py +++ b/wx/lib/agw/aui/dockart.py @@ -208,7 +208,7 @@ class AuiDefaultDockArt(object): self._active_caption_gradient_colour = LightContrastColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)) self._active_caption_text_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT) - self._inactive_caption_text_colour = wx.BLACK + self._inactive_caption_text_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT) def SetDefaultColours(self, base_colour=None):