Skip to content

Commit

Permalink
Use correct trait type for mouse pointers (#911)
Browse files Browse the repository at this point in the history
* Use correct trait type for mouse pointers.

Fixes #885

* Add a basic

* Add a basic test for the pointer shape traits.
  • Loading branch information
corranwebster authored Mar 16, 2022
1 parent 8dc913d commit d3b59ff
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
10 changes: 5 additions & 5 deletions enable/drawing/point_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Thanks for using Enthought open source!
""" A point-to-point drawn polygon. """

from enable.api import cursor_style_trait, Line
from traits.api import Event, Int, Instance

from enable.api import Line, Pointer
from .drawing_tool import DrawingTool


Expand All @@ -29,10 +29,10 @@ class PointLine(DrawingTool):
proximity_distance = Int(4)

# The cursor shapes to use for various modes
normal_cursor = cursor_style_trait("arrow")
drawing_cursor = cursor_style_trait("pencil")
delete_cursor = cursor_style_trait("bullseye")
move_cursor = cursor_style_trait("sizing")
normal_cursor = Pointer("arrow")
drawing_cursor = Pointer("pencil")
delete_cursor = Pointer("bullseye")
move_cursor = Pointer("sizing")

# The index of the vertex being dragged, if any.
_dragged = Int
Expand Down
24 changes: 24 additions & 0 deletions enable/tests/drawing/test_point_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at http://www.enthought.com/licenses/BSD.txt
#
# Thanks for using Enthought open source!

import unittest

from enable.drawing.point_line import PointLine


class TestPointLine(unittest.TestCase):

def test_pointer_shapes(self):
point_line = PointLine()

self.assertEqual(point_line.normal_cursor, "arrow")
self.assertEqual(point_line.drawing_cursor, "pencil")
self.assertEqual(point_line.delete_cursor, "bullseye")
self.assertEqual(point_line.move_cursor, "sizing")

0 comments on commit d3b59ff

Please sign in to comment.