~ubuntu-branches/ubuntu/utopic/python-chaco/utopic

« back to all changes in this revision

Viewing changes to examples/canvas/plot_clone_tool.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2011-04-06 19:03:54 UTC
  • mfrom: (7.2.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110406190354-rwd55l2ezjecfo41
Tags: 3.4.0-2
d/rules: fix pyshared directory path (Closes: #621116)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
""" Makes a copy of the plot in the overlay and adds it to the canvas.
2
2
"""
3
3
 
 
4
from __future__ import with_statement
4
5
 
5
6
# Enthought library imports
6
7
from enthought.traits.api import Bool, Callable, Enum, Float, Instance, Int, Trait, Tuple
7
 
from enthought.enable.api import Canvas, Component, Container
 
8
from enthought.enable.api import Container
8
9
 
9
10
# Chaco imports
10
11
from enthought.chaco.api import AbstractOverlay
50
51
        else:
51
52
            if self._offset is not None and (self._offset[0] > 10 or
52
53
                    self._offset[1] > 10):
53
 
                gc.save_state()
54
 
                gc.clear_clip_path()
55
 
                gc.translate_ctm(*self._offset)
56
 
                gc.set_alpha(self.alpha)
57
 
                self._recursion_check = True
58
 
                self.component._draw(gc, view_bounds, mode)
59
 
                self._recursion_check = False
60
 
                gc.restore_state()
 
54
                with gc:
 
55
                    gc.clear_clip_path()
 
56
                    gc.translate_ctm(*self._offset)
 
57
                    gc.set_alpha(self.alpha)
 
58
                    self._recursion_check = True
 
59
                    self.component._draw(gc, view_bounds, mode)
 
60
                    self._recursion_check = False
61
61
 
62
62
    def drag_start(self, event):
63
63
        """ Called when the drag operation starts.