Inherits from
- AbstractOverlay: enthought.chaco.abstract_overlay.AbstractOverlay
Attributes
- component
The component that this tool overlays
component = Instance(Component)
- delete_cursor
Cursor shape for deleting points.
delete_cursor = cursor_style_trait('bullseye')
- draw_mode
How the tool draws on top of its component. Deprecated.
draw_mode = 'overlay'
- event_state
The event states are:
- normal:
- The user may have selected points, and is moving the cursor around.
- selecting:
- The user has clicked down but hasn't let go of the button yet, and can still drag the point around.
- dragging:
- The user has clicked on an existing point and is dragging it around. When the user releases the mouse button, the tool returns to the "normal" state
event_state = Enum('normal', 'selecting', 'dragging')
- line
The current line segment being drawn.
line = Instance(Line, args = ())
- mouse_position
The data (index, value) position of the mouse cursor; this is used by various draw() routines.
mouse_position = Trait(None, None, Tuple)
- move_cursor
Cursor shape for moving points.
move_cursor = cursor_style_trait('sizing')
- normal_cursor
Cursor shape for drawing.
normal_cursor = cursor_style_trait('pencil')
- original_cursor
Cursor shape for non-tool use.
original_cursor = cursor_style_trait('arrow')
- points
A list of the points in data space as (index,value)
points = List
- proximity_distance
The pixel distance from a vertex that is considered 'on' the vertex.
proximity_distance = Int(4)
- visible
The tool is initially invisible, because there is nothing to draw.
visible = Bool(False)
Inherited from base classes
- accepts_focus
- active_tool
- aspect_ratio
- auto_center
- auto_handle_event
- backbuffer_padding
- border_color
- border_dash
- border_visible
- border_width
- bounds
- classes
- container
- controller
- cursor_color
- cursor_style
- draw_order
- draw_valid
- drawn_outer_bounds
- drawn_outer_position
- fill_padding
- get
- height
- hpadding
- id
- inset_border
- invisible_layout
- layout_needed
- on_trait_event
- outer_bounds
- outer_height
- outer_position
- outer_width
- outer_x
- outer_x2
- outer_y
- outer_y2
- overlay_border
- overlays
- padding
- padding_accepts_focus
- padding_bottom
- padding_left
- padding_right
- padding_top
- pointer
- position
- resizable
- set
- tools
- tooltip
- trait_added
- trait_modified
- underlays
- unified_draw
- use_backbuffer
- use_draw_order
- use_selection
- viewports
- vpadding
- width
- window
- wrappers
- x
- x2
- y
- y2
Method summary
- __init__(self, component = None, **kwtraits)
- add_point(self, point)
- dragging_draw(self, gc)
- dragging_key_pressed(self, event)
- dragging_left_up(self, event)
- dragging_mouse_leave(self, event)
- dragging_mouse_move(self, event)
- get_point(self, index)
- normal_draw(self, gc)
- normal_key_pressed(self, event)
- normal_left_down(self, event)
- normal_mouse_leave(self, event)
- normal_mouse_move(self, event)
- overlay(self, component, gc, view_bounds, mode = 'normal')
- remove_point(self, index)
- request_redraw(self)
- reset(self)
- set_point(self, index, point)
Inherited from base classes
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name, is_set)
- __reduce_ex__(self, protocol)
- __setstate__(self, state, trait_change_notify = True)
- add_class_trait(cls, name, *trait)
- add_trait(self, name, *trait)
- add_trait_category(cls, category)
- add_trait_listener(self, object, prefix = '')
- all_trait_names(self)
- as_coordinates(self)
- base_trait(self, name)
- class_default_traits_view(cls)
- class_editable_traits(cls)
- class_trait_names(cls, **metadata)
- class_trait_view(cls, name = None, view_element = None)
- class_trait_view_elements(cls)
- class_traits(cls, **metadata)
- cleanup(self, window)
- clone_traits(self, traits = None, memo = None, copy = None, **metadata)
- configure_traits(self, filename = None, view = None, kind = None, edit = True, context = None, handler = None, id = '', scrollable = None, **args)
- copy_traits(self, other, traits = None, memo = None, copy = None, **metadata)
- copyable_trait_names(self, **metadata)
- default_traits_view(self)
- dispatch(self, event, suffix)
- do_layout(self, size = None, force = False)
- draw(self, gc, view_bounds = None, mode = 'default')
- draw_select_box(self, gc, position, bounds, width, dash, inset, color, bgcolor, marker_size)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- get_absolute_coords(self, *coords)
- get_event_transform(self, event = None, suffix = '')
- get_preferred_size(self)
- has_traits_interface(self, *interfaces)
- invalidate_and_redraw(self)
- invalidate_draw(self, damaged_regions = None, self_relative = False)
- is_in(self, x, y)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same', priority = False, deferred = False)
- print_traits(self, show_help = False, **metadata)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- reset_traits(self, traits = None, **metadata)
- set_outer_bounds(self, ndx, val)
- set_outer_position(self, ndx, val)
- set_trait_dispatch_handler(cls, name, klass, override = False)
- sync_trait(self, trait_name, object, alias = None, mutual = True, remove = False)
- trait(self, name, force = False, copy = False)
- trait_context(self)
- trait_get(self, *names, **metadata)
- trait_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- trait_set(self, trait_change_notify = True, **traits)
- trait_setq(self, **traits)
- trait_subclasses(cls, all = False)
- trait_view(self, name = None, view_element = None)
- trait_view_elements(self)
- trait_views(self, klass = None)
- traits(self, **metadata)
- validate_trait(self, name, value)
Methods
- __init__(self, component = None, **kwtraits)
- add_point(self, point)
Given a screen-space point (x,y), adds the corresponding data space point to the list for this tool.
- dragging_draw(self, gc)
Draws the polygon in the 'dragging' state.
- dragging_key_pressed(self, event)
Handles a key being pressed in the 'dragging' state.
If the key is "Esc", the drag operation is canceled.
- dragging_left_up(self, event)
Handles the left mouse coming up in the 'dragging' state.
Switches to 'normal' state.
- dragging_mouse_leave(self, event)
Handles the mouse leaving the tool area in the 'dragging' state.
The drag is canceled and the cursor changes to an arrow.
- dragging_mouse_move(self, event)
Handles the user moving the mouse while in the 'dragging' state.
The screen is updated to show the new mouse position as the end of the line segment being drawn.
- get_point(self, index)
Retrieves the indexed point and returns its screen space value.
- normal_draw(self, gc)
Draws the line.
- normal_key_pressed(self, event)
Handles the user pressing a key in the 'normal' state.
If the user presses the Enter key, the tool is reset.
- normal_left_down(self, event)
Handles the left mouse button being pressed while the tool is in the 'normal' state.
For an existing point, if the user is pressing the Control key, the point is deleted. Otherwise, the user can drag the point.
For a new point, the point is added, and the user can drag it.
- normal_mouse_leave(self, event)
Handles the user moving the cursor away from the tool area.
- normal_mouse_move(self, event)
Handles the user moving the mouse in the 'normal' state.
When the user moves the cursor over an existing point, if the Control key is pressed, the cursor changes to the delete_cursor, indicating that the point can be deleted. Otherwise, the cursor changes to the move_cursor, indicating that the point can be moved.
When the user moves the cursor over any other point, the cursor changes to (or stays) the normal_cursor.
- overlay(self, component, gc, view_bounds, mode = 'normal')
Draws this component overlaid on another component.
Implements AbstractOverlay.
- remove_point(self, index)
Removes the point for a given index from this tool's list of points.
- request_redraw(self)
Requests that the component redraw itself.
Overrides Enable Component.
- reset(self)
Resets the tool, throwing away any points, and making the tool invisible.
- set_point(self, index, point)
Sets the data-space index for a screen-space point.