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

« back to all changes in this revision

Viewing changes to enthought/chaco/tools/point_marker.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
""" Defines the PointMarker tool class.
2
2
"""
 
3
from __future__ import with_statement
 
4
 
3
5
# Major library imports
4
6
from numpy import array, take, transpose
5
7
 
64
66
    #------------------------------------------------------------------------
65
67
 
66
68
    def _draw_vertical_lines(self, gc, points):
67
 
        gc.save_state()
68
 
        try:
 
69
        with gc:
69
70
            gc.set_stroke_color(self.color_)
70
71
            for pt in points:
71
72
                gc.move_to(int(pt[0])+0.5, self.component.y)
72
73
                gc.line_to(int(pt[0])+0.5, self.component.y2)
73
74
            gc.stroke_path()
74
 
        finally:
75
 
            gc.restore_state()
76
75
        return
77
76
    
78
77
    def _draw_horizontal_lines(self, gc, points):
79
 
        gc.save_state()
80
 
        try:
 
78
        with gc:
81
79
            gc.set_stroke_color(self.color_)
82
80
            for pt in points:
83
81
                gc.move_to(self.component.x, int(pt[1])+0.5)
84
82
                gc.line_to(self.component.x2, int(pt[1])+0.5)
85
83
            gc.stroke_path()
86
 
        finally:
87
 
            gc.restore_state()
88
84
        return
89
85
 
90
86