/usr/lib/python2.7/dist-packages/chaco/ui/popupable_plot.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 | # Enthought library imports
from traits.api import List
from chaco.api import VPlotContainer
from chaco.plot import Plot
from chaco.tools.api import PanTool, ZoomTool
from chaco.ui.plot_window import PlotWindow
from traitsui.wx.constants import WindowColor
class PopupablePlot(Plot):
"""A Plot class that pops up in a new window on double click"""
# FIXME: It would be nice to queue up other types of commands and settings
command_queue = List()
def normal_left_dclick(self, event):
plot = Plot(self.data)
for data, kw in self.command_queue:
plot.plot(data, **kw)
plot.title = self.title
plot.title = self.title
container = VPlotContainer(bgcolor=WindowColor)
container.add(plot)
plot.tools.append(PanTool(plot))
plot.overlays.append(ZoomTool(plot))
window = PlotWindow(plot=container)
window.edit_traits(kind='live', parent=event.window.control)
def plot(self, data, **kw):
"""Queue up the plot commands"""
self.command_queue.append((data, kw))
super(PopupablePlot, self).plot(data, **kw)
return
|