blob: 70b9e5fad1b30e027fc94cf15b468aff0ada3eb0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
###############################################################################
# Name: wxcompat.py #
# Purpose: Help with compatibility between wx versions. #
# Author: Cody Precord <cprecord@editra.org> #
# Copyright: (c) 2008 Cody Precord <staff@editra.org> #
# License: wxWindows License #
###############################################################################
"""
@summary: wx Compatibility helper module
"""
__author__ = "Cody Precord <cprecord@editra.org>"
__svnid__ = "$Id: wxcompat.py 68998 2011-09-03 22:03:32Z CJP $"
__revision__ = "$Revision: 68998 $"
#-----------------------------------------------------------------------------#
# Imports
import os
import wx
#-----------------------------------------------------------------------------#
if wx.Platform == '__WXMAC__':
# MacThemeColour is defined in wxPython2.9 but does not exist in 2.8
# This is a 2.8 version of this method.
if not hasattr(wx, 'MacThemeColour'):
def MacThemeColour(theme_id):
"""Get a specified Mac theme colour
@param theme_id: Carbon theme id
@return: wx.Colour
"""
brush = wx.Brush(wx.BLACK)
brush.MacSetTheme(theme_id)
return brush.GetColour()
wx.MacThemeColour = MacThemeColour
wx.SystemOptions.SetOptionInt("mac.textcontrol-use-spell-checker", 1)
elif wx.Platform == '__WXGTK__':
os.environ['LIBOVERLAY_SCROLLBAR'] = '0'
# GetText is not available in 2.9 but GetItemLabel is not available pre 2.8.6
if wx.VERSION < (2, 8, 6, 0, ''):
wx.MenuItem.GetItemLabel = wx.MenuItem.GetText
wx.MenuItem.GetItemLabelText = wx.MenuItem.GetLabel
|