This file is indexed.

/usr/lib/python2.7/dist-packages/chaco/plugin/plot_editor.py is in python-chaco 4.4.1-1.2.

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
from chaco.shell.scaly_plot import ScalyPlot
from enable.component_editor import ComponentEditor
from pyface.workbench.api import TraitsUIEditor
from traits.api import Any, Enum, HasTraits, Property, Str
from traitsui import api as tui


class PlotUI(HasTraits):
    """ Simple Traits UI proxy for a Chaco plot.
    """

    # The plot.
    component = Any()

    traits_view = tui.View(
        tui.Item('component', editor=ComponentEditor(), show_label=False),

        resizable=True,
    )


class PlotEditor(TraitsUIEditor):
    """ A Workbench Editor showing a Chaco plot for the shell interface.
    """

    bgcolor = Str('white')
    image_default_origin = Enum("bottom left", "top left",
                                "bottom right", "top right")

    # The plot.
    component = Property(Any)
    container = Property(Any)

    # The PlotData.
    data = Any()

    # The PlotSession of which we are a part.  We need to know this in order
    # to notify it of our being closed, etc.
    session = Any()

    def __init__(self, is_image=False, bgcolor="white",
                 image_default_origin="top left", *args, **kw):

        super(TraitsUIEditor, self).__init__(**kw)

        # Some defaults which should be overridden by preferences.
        self.bgcolor = bgcolor
        self.image_default_origin = image_default_origin

        # Create an empty top-level container
        if is_image:
            top_container = self._create_top_img_container()
        else:
            top_container = self._create_top_container()

        self.obj = PlotUI(component=top_container)


    #### PlotWindow interface ##################################################

    def get_container(self):
        return self.obj.component

    def set_container(self, container):
        self.obj.component = container

    def iconize(self, iconize):
        """Iconizes the window if *iconize* is True.

        Do nothing in this implementation.
        """

    def maximize(self, maximize):
        """ If *maximize* is True, maximizes the window size; restores if False.

        Do nothing in this implementation.
        """

    def set_size(self, width, height):
        pass

    def set_title(self, title):
        self.name = title

    def raise_window(self):
        self.window.activate_editor(self)


    #### Editor interface ######################################################

    def destroy_control(self):
        """ Destroy the toolkit-specific control that represents the part.
        """
        self._on_window_close()
        super(TraitsUIEditor, self).destroy_control()


    #### Private interface #####################################################

    def _get_container(self):
        return self.obj.component

    def _set_container(self, value):
        self.obj.component = value

    def _get_component(self):
        return self.obj.component

    def _set_component(self, value):
        self.obj.component = value

    def _create_top_container(self):
        plot = ScalyPlot(
            padding=50,
            fill_padding=True,
            bgcolor=self.bgcolor,
            use_backbuffer=True,
        )
        return plot

    def _create_top_img_container(self):
        plot = ScalyPlot(
            padding=50,
            fill_padding=True,
            bgcolor=self.bgcolor,
            use_backbuffer=True,
            default_origin=self.image_default_origin,
        )
        return plot

    def _on_window_close(self):
        if self.session:
            try:
                ndx = self.session.windows.index(self)
                self.session.del_window(ndx)
            except ValueError:
                pass