This file is indexed.

/usr/lib/python2.7/dist-packages/chaco/simple_plot_frame.py is in python-chaco 4.5.0-1.

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

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
""" Defines the (deprecated) SimplePlotFrame class.
"""

#################################################################################
#
# NOTE: PlotFrames are deprecated.  There is no need to use them any more.
# This class will be removed sometime in the near future.
#
#################################################################################

from __future__ import with_statement

# Enthought library imports
from traits.api import Bool

# Local, relative imports
from base_plot_frame import BasePlotFrame
from plot_containers import OverlayPlotContainer

class SimplePlotFrame(BasePlotFrame):
    """
    A plot frame with just a single, center container that takes up the entire
    frame.

    NOTE: PlotFrames are deprecated.  There is no need to use them any more.
    This class will be removed sometime in the future.
    """

    # This frame has only one position for plot components. Overrides
    # PlotFrame.
    slot_names = ("center")

    # Default width and height. Class attribute.
    default_bounds = (500, 500)

    # This frame does not resize to fit components. Overrides PlotFrame.
    fit_components = ""

    # This frame maximizes itself within the window, if it is a top-level
    # component. Overrides Enable Container.
    fit_window = True

    #------------------------------------------------------------------------
    # Private traits
    #------------------------------------------------------------------------

    # Does the component need to do a layout call?
    _layout_needed = Bool(True)


    def __init__(self, **kwtraits):
        # Delay setting the bounds until after base class initialization
        if kwtraits.has_key("bounds"):
            bounds = kwtraits.pop("bounds")
        else:
            bounds = list(self.default_bounds)
        BasePlotFrame.__init__(self, **kwtraits)
        self.set_slot("center", OverlayPlotContainer(resizable="hv"))
        self.bounds = bounds
        return

    #------------------------------------------------------------------------
    # Protected methods
    #------------------------------------------------------------------------

    def _draw_component(self, gc, view_bounds=None, mode="normal"):
        """ Draws the component.

        This method is preserved for backwards compatibility with _old_draw().
        Overrides PlotComponent.
        """
        with gc:
            # Translate to our .position, because even though we are supposed
            # to be a top-level Chaco component, we might still be contained
            # within other Enable components.
            gc.translate_ctm(*self.position)
            with gc:
                self.center.draw(gc, view_bounds, mode)
        return

    def get_preferred_size(self):
        """ Returns the size (width,height) that is preferred for this component.

        Overrides PlotComponent.
        """
        size = [0,0]
        component_pref_size = None
        if "h" not in self.resizable:
            if "h" in self.fit_components:
                component_pref_size = self.center.get_preferred_size()
                size[0] = component_pref_size[0]
            else:
                size[0] = self.default_bounds[0]
        if "v" not in self.resizable:
            if "v" in self.fit_components:
                if not component_pref_size:
                    component_pref_size = self.center.get_preferred_size()
                size[1] = component_pref_size[1]
            else:
                size[1] = self.default_bounds[1]
        return size

    def _do_layout(self):
        """
        Performs a layout and sets the size and positions on this frame's
        containers, given its width and height.
        """
        component = self.center

        preferred_size = None
        if "h" in component.resizable:
            component.outer_width = self.width
        elif "h" in self.fit_components:
            preferred_size = component.get_preferred_size()
            component.outer_width = preferred_size[0]
            self.width = preferred_size[0]
        else:
            # We are not autosizing to our component, and it's not going to
            # auto-size to our bounds, so do nothing.
            pass

        if "v" in component.resizable:
            component.outer_height = self.height
        elif "v" in self.fit_components:
            if preferred_size is None:
                preferred_size = component.get_preferred_size()
            component.outer_height = preferred_size[1]
            self.height = preferred_size[1]
        else:
            # We are not autosizing to our component, and it's not going to
            # auto-size to our bounds, so do nothing.
            pass

        component.outer_position = [0,0]
        component.do_layout()
        return

    ### Persistence ###########################################################
    #_pickles = ()

    def __getstate__(self):
        state = super(SimplePlotFrame,self).__getstate__()
        for key in ['_layout_needed']:
            if state.has_key(key):
                del state[key]

        return state


# EOF