~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/src/wxcompat.py

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

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