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

« back to all changes in this revision

Viewing changes to examples/zoomed_plot/zoom_overlay.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
 
2
 
from numpy import array, amax, amin, clip
 
2
from __future__ import with_statement
 
3
 
 
4
from numpy import array, amax, amin
3
5
 
4
6
from enthought.enable.api import ColorTrait, Component
5
7
from enthought.traits.api import Float, Instance, Int
64
66
        
65
67
        left_line, right_line, polygon = self.calculate_points(component)
66
68
       
67
 
        gc.save_state()
68
 
        try:
 
69
        with gc:
69
70
            gc.translate_ctm(*component.position)
70
71
            gc.set_alpha(self.alpha)
71
72
            gc.set_fill_color(self.fill_color_)
79
80
            gc.lines(left_line)
80
81
            gc.lines(right_line)
81
82
            gc.stroke_path()
82
 
        finally:
83
 
            gc.restore_state()
 
83
 
84
84
        return
85
85
    
86
86
    def _get_selection_screencoords(self):