This file is indexed.

/usr/lib/python3/dist-packages/matplotlib/backends/wx_compat.py is in python3-matplotlib 1.5.1-1ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/env python
"""
A wx API adapter to hide differences between wxPython classic and phoenix.

It is assumed that the user code is selecting what version it wants to use,
here we just ensure that it meets the minimum required by matplotlib.

For an example see embedding_in_wx2.py
"""
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

from matplotlib.externals import six
from distutils.version import LooseVersion

missingwx = "Matplotlib backend_wx and backend_wxagg require wxPython >=2.8.12"


try:
    import wx
    backend_version = wx.VERSION_STRING
    is_phoenix = 'phoenix' in wx.PlatformInfo
except ImportError:
    raise ImportError(missingwx)

# Ensure we have the correct version imported
if LooseVersion(wx.VERSION_STRING) < LooseVersion("2.8.12"):
    print(" wxPython version %s was imported." % backend_version)
    raise ImportError(missingwx)

if is_phoenix:
    # define all the wxPython phoenix stuff

    # font styles, families and weight
    fontweights = {
        100: wx.FONTWEIGHT_LIGHT,
        200: wx.FONTWEIGHT_LIGHT,
        300: wx.FONTWEIGHT_LIGHT,
        400: wx.FONTWEIGHT_NORMAL,
        500: wx.FONTWEIGHT_NORMAL,
        600: wx.FONTWEIGHT_NORMAL,
        700: wx.FONTWEIGHT_BOLD,
        800: wx.FONTWEIGHT_BOLD,
        900: wx.FONTWEIGHT_BOLD,
        'ultralight': wx.FONTWEIGHT_LIGHT,
        'light': wx.FONTWEIGHT_LIGHT,
        'normal': wx.FONTWEIGHT_NORMAL,
        'medium': wx.FONTWEIGHT_NORMAL,
        'semibold': wx.FONTWEIGHT_NORMAL,
        'bold': wx.FONTWEIGHT_BOLD,
        'heavy': wx.FONTWEIGHT_BOLD,
        'ultrabold': wx.FONTWEIGHT_BOLD,
        'black': wx.FONTWEIGHT_BOLD
    }
    fontangles = {
        'italic': wx.FONTSTYLE_ITALIC,
        'normal': wx.FONTSTYLE_NORMAL,
        'oblique': wx.FONTSTYLE_SLANT}

    # wxPython allows for portable font styles, choosing them appropriately
    # for the target platform. Map some standard font names to the portable
    # styles
    # QUESTION: Is it be wise to agree standard fontnames across all backends?
    fontnames = {'Sans': wx.FONTFAMILY_SWISS,
                 'Roman': wx.FONTFAMILY_ROMAN,
                 'Script': wx.FONTFAMILY_SCRIPT,
                 'Decorative': wx.FONTFAMILY_DECORATIVE,
                 'Modern': wx.FONTFAMILY_MODERN,
                 'Courier': wx.FONTFAMILY_MODERN,
                 'courier': wx.FONTFAMILY_MODERN}

    dashd_wx = {'solid': wx.PENSTYLE_SOLID,
                'dashed': wx.PENSTYLE_SHORT_DASH,
                'dashdot': wx.PENSTYLE_DOT_DASH,
                'dotted': wx.PENSTYLE_DOT}

    # functions changes
    BitmapFromBuffer = wx.Bitmap.FromBufferRGBA
    EmptyBitmap = wx.Bitmap
    EmptyImage = wx.Image
    Cursor = wx.Cursor
    EventLoop = wx.GUIEventLoop
    NamedColour = wx.Colour
    StockCursor = wx.Cursor

else:
    # define all the wxPython classic stuff

    # font styles, families and weight
    fontweights = {
        100: wx.LIGHT,
        200: wx.LIGHT,
        300: wx.LIGHT,
        400: wx.NORMAL,
        500: wx.NORMAL,
        600: wx.NORMAL,
        700: wx.BOLD,
        800: wx.BOLD,
        900: wx.BOLD,
        'ultralight': wx.LIGHT,
        'light': wx.LIGHT,
        'normal': wx.NORMAL,
        'medium': wx.NORMAL,
        'semibold': wx.NORMAL,
        'bold': wx.BOLD,
        'heavy': wx.BOLD,
        'ultrabold': wx.BOLD,
        'black': wx.BOLD
    }
    fontangles = {
        'italic': wx.ITALIC,
        'normal': wx.NORMAL,
        'oblique': wx.SLANT}

    # wxPython allows for portable font styles, choosing them appropriately
    # for the target platform. Map some standard font names to the portable
    # styles
    # QUESTION: Is it be wise to agree standard fontnames across all backends?
    fontnames = {'Sans': wx.SWISS,
                 'Roman': wx.ROMAN,
                 'Script': wx.SCRIPT,
                 'Decorative': wx.DECORATIVE,
                 'Modern': wx.MODERN,
                 'Courier': wx.MODERN,
                 'courier': wx.MODERN}

    dashd_wx = {'solid': wx.SOLID,
                'dashed': wx.SHORT_DASH,
                'dashdot': wx.DOT_DASH,
                'dotted': wx.DOT}

    # functions changes
    BitmapFromBuffer = wx.BitmapFromBufferRGBA
    EmptyBitmap = wx.EmptyBitmap
    EmptyImage = wx.EmptyImage
    Cursor = wx.StockCursor
    EventLoop = wx.EventLoop
    NamedColour = wx.NamedColour
    StockCursor = wx.StockCursor


def _AddTool(parent, wx_ids, text, bmp, tooltip_text):
    if is_phoenix:
        if text in ['Pan', 'Zoom']:
            kind = wx.ITEM_CHECK
        else:
            kind = wx.ITEM_NORMAL
        parent.AddTool(wx_ids[text], label=text,
                       bitmap=bmp,
                       bmpDisabled=wx.NullBitmap,
                       shortHelpString=text,
                       longHelpString=tooltip_text,
                       kind=kind)
    else:
        if text in ['Pan', 'Zoom']:
            parent.AddCheckTool(
                wx_ids[text],
                bmp,
                shortHelp=text,
                longHelp=tooltip_text)
        else:
            parent.AddSimpleTool(wx_ids[text], bmp, text, tooltip_text)