Inherits from
- AbstractController: enthought.chaco.abstract_controller.AbstractController
Attributes
- axis
The axis to which this tool is perpendicular.
axis = Enum('index', 'value')
- axis_index
The index to use for axis. By default, this is self.plot.orientation, but it can be overriden and set to 0 or 1.
axis_index = Property
- enable_resize
Can the user resize the selection once it has been drawn?
enable_resize = Bool(True)
- event_state
The possible event states of this selection tool (overrides enable.Interactor).
- normal:
- Nothing has been selected, and the user is not dragging the mouse.
- selecting:
- The user is dragging the mouse and actively changing the selection region; resizing of an existing selection also uses this mode.
- selected:
- The user has released the mouse and a selection has been finalized. The selection remains until the user left-clicks or self.deselect() is called.
- moving:
- The user moving (not resizing) the selection range.
event_state = Enum('normal', 'selecting', 'selected', 'moving')
- left_button_selects
Allow the left button begin a selection?
left_button_selects = Bool(False)
- listeners
List of listeners that listen to selection events.
listeners = List
- mapper
The mapper for associated with this tool. By default, this is the mapper on plot that corresponds to axis.
mapper = Property
- plot
The plot associated with this tool By default, this is just self.component.
plot = Property
- resize_margin
The pixel distance between the mouse event and a selection endpoint at which the user action will be construed as a resize operation.
resize_margin = Int(7)
- selection
The selected region, expressed as a tuple in data space. This updates and fires change-events as the user is dragging.
selection = Property
- selection_completed
This event is fired when the user completes the selection. The value of the event is the data space range
selection_completed = Event
Inherited from base classes
Method summary
- __mapper_changed(self)
- deselect(self, event = None)
- moving_left_up(self, event)
- moving_mouse_enter(self, event)
- moving_mouse_leave(self, event)
- moving_mouse_move(self, event)
- normal_left_down(self, event)
- normal_right_down(self, event)
- selected_left_down(self, event)
- selected_mouse_leave(self, event)
- selected_mouse_move(self, event)
- selected_right_down(self, event)
- selecting_left_up(self, event)
- selecting_mouse_enter(self, event)
- selecting_mouse_leave(self, event)
- selecting_mouse_move(self, event)
- selecting_right_up(self, event)
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)
- 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)
- 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)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- get_event_transform(self, event = None, suffix = '')
- has_traits_interface(self, *interfaces)
- 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_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
- __mapper_changed(self)
- deselect(self, event = None)
Deselects the highlighted region.
This method essentially resets the tool. It takes the event causing the deselection as an optional argument.
- moving_left_up(self, event)
Handles the left mouse button coming up when the tool is in the 'moving' state.
Switches the tool to the 'selected' state.
- moving_mouse_enter(self, event)
- moving_mouse_leave(self, event)
Handles the mouse leaving the plot while the tool is in the 'moving' state.
If the mouse was within the selection region when it left, the method does nothing.
If the mouse was outside the selection region whe it left, the event is treated as moving the selection to the minimum or maximum.
- moving_mouse_move(self, event)
Handles the mouse moving when the tool is in the 'moving' state.
Moves the selection range by an amount corresponding to the amount that the mouse has moved since its button was pressed. If the new selection range overlaps the endpoints of the data, it is truncated to that endpoint.
- normal_left_down(self, event)
Handles the left mouse button being pressed when the tool is in the 'normal' state.
If the tool allows the left mouse button to start a selection, then it does so.
- normal_right_down(self, event)
Handles the right mouse button being pressed when the tool is in the 'normal' state.
Puts the tool into 'selecting' mode, changes the cursor to show that it is selecting, and starts defining the selection.
- selected_left_down(self, event)
Handles the left mouse button being pressed when the tool is in the 'selected' state.
If the user is allowed to resize the selection, and the event occurred within the resize margin of an endpoint, then the tool switches to the 'selecting' state so that the user can resize the selection.
If the event is within the bounds of the selection region, then the tool switches to the 'moving' states.
Otherwise, the selection becomes deselected.
- selected_mouse_leave(self, event)
Handles the mouse leaving the plot when the tool is in the 'selected' state.
Sets the cursor to an arrow.
- selected_mouse_move(self, event)
Handles the mouse moving when the tool is in the 'selected' srate.
If the user is allowed to resize the selection, and the event occurred within the resize margin of an endpoint, then the cursor changes to indicate that the selection could be resized.
Otherwise, the cursor is set to an arrow.
- selected_right_down(self, event)
Handles the right mouse button being pressed when the tool is in the 'selected' state.
If the user is allowed to resize the selection, and the event occurred within the resize margin of an endpoint, then the tool switches to the 'selecting' state so that the user can resize the selection.
Otherwise, the selection becomes deselected, and a new selection is started..
- selecting_left_up(self, event)
Handles the left mouse button coming up when the tool is in the 'selecting' state.
Switches the tool to the 'selected' state.
- selecting_mouse_enter(self, event)
Handles the mouse entering the plot when the tool is in the 'selecting' state.
If the mouse does not have the right mouse button down, this event is treated as if the right mouse button was released. Otherwise, the method sets the cursor to show that it is selecting.
- selecting_mouse_leave(self, event)
Handles the mouse leaving the plot when the tool is in the 'selecting' state.
Determines whether the event's position is outside the component's bounds, and if so, clips the selection. Sets the cursor to an arrow.
- selecting_mouse_move(self, event)
Handles the mouse being moved when the tool is in the 'selecting' state.
Expands the selection range at the appropriate end, based on the new mouse position.
- selecting_right_up(self, event)
Handles the right mouse button coming up when the tool is in the 'selecting' state.
Switches the tool to the 'selected' state and completes the selection.