This file is indexed.

/usr/lib/python2.7/dist-packages/chaco/tools/point_marker.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
""" Defines the PointMarker tool class.
"""
from __future__ import with_statement

# Major library imports
from numpy import array, take, transpose

# Enthought library imports
from enable.api import BaseTool, ColorTrait
from traits.api import Enum, Float


class PointMarker(BaseTool):
    """ This tool looks at an XY plot's index data source and draws a
    line corresponding to the index indicated by the "selections" metadata.
    """

    # The axis that this tool is parallel to.
    axis = Enum("index", "value")

    # This tool is visible (overrides BaseTool).
    visible = True
    # This tool is drawn as an overlay (overrides BaseTool).
    draw_mode = "overlay"

    # TODO:STYLE

    # The color of the line.
    color = ColorTrait("red")
    # The width of the line, in pixels.
    line_width = Float(1.0)

    def draw(self, gc, view_bounds=None):
        """ Draws this tool on a graphics context.

        Implements BaseTool.
        """
        # Draw the component in interactive mode
        plot = self.component
        if plot is not None:
            # selections should be a list of indices on the datasource
            indices = getattr(plot, self.axis).metadata["selections"]

            if len(indices) == 0:
                return

            index_pts = take(plot.index.get_data(), indices)
            value_pts = take(plot.value.get_data(), indices)
            data_pts = transpose(array((index_pts, value_pts)))
            screen_pts = plot.map_screen(data_pts)

            if self.axis == "index":
                if plot.orientation == "h":
                    self._draw_vertical_lines(gc, screen_pts)
                else:
                    self._draw_horizontal_lines(gc, screen_pts)
            else:   # self.axis == "value"
                if plot.orientation == "h":
                    self._draw_horizontal_lines(gc, screen_pts)
                else:
                    self._draw_vertical_lines(gc, screen_pts)
        return

    #------------------------------------------------------------------------
    # Private methods
    #------------------------------------------------------------------------

    def _draw_vertical_lines(self, gc, points):
        with gc:
            gc.set_stroke_color(self.color_)
            for pt in points:
                gc.move_to(int(pt[0])+0.5, self.component.y)
                gc.line_to(int(pt[0])+0.5, self.component.y2)
            gc.stroke_path()
        return

    def _draw_horizontal_lines(self, gc, points):
        with gc:
            gc.set_stroke_color(self.color_)
            for pt in points:
                gc.move_to(self.component.x, int(pt[1])+0.5)
                gc.line_to(self.component.x2, int(pt[1])+0.5)
            gc.stroke_path()
        return



# EOF