/usr/lib/python2.7/dist-packages/chaco/tools/tracking_pan_tool.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 | """ Defines the TrackingPanTool class.
"""
# Chaco imports
from chaco.tools.api import PanTool
class TrackingPanTool(PanTool):
""" Allows the user to pan around a plot.
The user clicks a mouse button and drags to pan; the tool then returns to
a tracking state.
"""
def _end_pan(self, event):
plot = self.component
xrange = plot.x_mapper.range
yrange = plot.y_mapper.range
if not self.constrain or self.constrain_direction == "x":
high = xrange.high
low = xrange.low
if xrange.default_state == 'low_track':
hi_val = max([source.get_bounds()[1] for source in xrange.sources])
if hi_val >= low and hi_val <= high:
xrange.set_bounds('track','auto')
elif xrange.default_state == 'high_track':
lo_val = min([source.get_bounds()[0] for source in xrange.sources])
if lo_val >= low and lo_val <= high:
xrange.set_bounds('auto','track')
if not self.constrain or self.constrain_direction == "y":
high = yrange.high
low = yrange.low
if yrange.default_state == 'low_track':
hi_val = max([source.get_bounds()[1] for source in yrange.sources])
if hi_val >= low and hi_val <= high:
yrange.set_bounds('track','auto')
elif yrange.default_state == 'high_track':
lo_val = min([source.get_bounds()[0] for source in yrange.sources])
if lo_val >= low and lo_val <= high:
yrange.set_bounds('auto','track')
if self._auto_constrain:
self.constrain = False
self.constrain_direction = None
self.event_state = "normal"
event.window.set_pointer("arrow")
if event.window.mouse_owner == self:
event.window.set_mouse_owner(None)
event.handled = True
return
# EOF
|