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

« back to all changes in this revision

Viewing changes to enthought/chaco/tools/line_inspector.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 LineInspector tool class.
2
2
"""
 
3
from __future__ import with_statement
3
4
 
4
5
# Enthought library imports
5
6
from enthought.enable.api import BaseTool, ColorTrait, LineStyle
253
254
        if sx < self.component.x or sx > self.component.x2:
254
255
            return
255
256
            
256
 
        gc.save_state()
257
 
        try:
 
257
        with gc:
258
258
            gc.set_stroke_color(self.color_)
259
259
            gc.set_line_width(self.line_width)
260
260
            gc.set_line_dash(self.line_style_)
261
261
            gc.move_to(sx, self.component.y)
262
262
            gc.line_to(sx, self.component.y2)
263
263
            gc.stroke_path()
264
 
        finally:
265
 
            gc.restore_state()
266
264
        return
267
265
    
268
266
    def _draw_horizontal_line(self, gc, sy):
272
270
        if sy < self.component.y or sy > self.component.y2:
273
271
            return
274
272
            
275
 
        gc.save_state()
276
 
        try:
 
273
        with gc:
277
274
            gc.set_stroke_color(self.color_)
278
275
            gc.set_line_width(self.line_width)
279
276
            gc.set_line_dash(self.line_style_)
280
277
            gc.move_to(self.component.x, sy)
281
278
            gc.line_to(self.component.x2, sy)
282
279
            gc.stroke_path()
283
 
        finally:
284
 
            gc.restore_state()
285
280
        return
286
281
 
287
282