Inherits from
- CoordinateBox: enthought.enable.coordinate_box.CoordinateBox
- Interactor: enthought.enable.interactor.Interactor
Attributes
- aspect_ratio
The ratio of the component's width to its height. This is used by the component itself to maintain bounds when the bounds are changed independently, and is also used by the layout system.
aspect_ratio = Trait(None, None, Float)
- auto_center
When the component's bounds are set to a (width,height) tuple that does not conform to the set aspect ratio, does the component center itself in the free space?
auto_center = Bool(True)
- auto_handle_event
Events are not automatically considered "handled" if there is a handler defined. Overrides an inherited trait from Enable's Interactor class.
auto_handle_event = False
- backbuffer_padding
Should the backbuffer extend to the pad area?
backbuffer_padding = Bool(True)
- bgcolor
The background color of this component. By default all components have a white background. This can be set to "transparent" or "none" if the component should be see-through.
bgcolor = white_color_trait
- border_color
The color of the border. Only used if border_visible is True.
border_color = black_color_trait
- border_dash
The line style (i.e. dash pattern) of the border.
border_dash = LineStyle
- border_visible
Is the border visible? If this is false, then all the other border properties are not
border_visible = Bool(False)
- border_width
The width of the border around this component. This is taken into account during layout, but only if the border is visible.
border_width = Int(1)
- classes
A list of strings defining the classes to which this component belongs. These classes will be used to determine how this component is styled, is rendered, is laid out, and receives events. There is no automatic management of conflicting class names, so if a component is placed into more than one class and that class
classes = List
- container
Our container object
container = Any
- controller
An Enable Interactor that all events are deferred to.
controller = Any
- draw_layer
If unified_draw is True for this component, then this attribute determines what layer it will be drawn on. This is used by containers and external classes, whose drawing loops call this component. If unified_draw is False, then this attribute is ignored.
draw_layer = Str('mainlayer')
- draw_order
The order in which various rendering classes on this component are drawn. Note that if this component is placed in a container, in most cases the container's draw order is used, since the container calls each of its contained components for each rendering pass. Typically, the definitions of the layers are:
'background': Background image, shading, and (possibly) borders
'mainlayer': The main layer that most objects should draw on
- 'border': A special layer for rendering the border on top of the
component instead of under its main layer (see overlay_border)
- 'overlay': Legends, selection regions, and other tool-drawn visual
elements
draw_order = Instance(list, args = (DEFAULT_DRAWING_ORDER))
- draw_valid
If a draw were to occur, whether the component would actually change. This is useful for determining whether a backbuffer is valid, and is usually set by the component itself or set on the component by calling _invalidate_draw(). It is exposed as a public trait for the rare cases when another component wants to know the validity of this component's backbuffer.
draw_valid = Bool(False)
- drawn_outer_bounds
drawn_outer_bounds specifies the bounds of this component on the last draw cycle. Used in conjunction with outer_position_last_draw
drawn_outer_bounds = bounds_trait
- drawn_outer_position
drawn_outer_position specifies the outer position this component was drawn to on the last draw cycle. This is used to determine what areas of the screen are damaged.
drawn_outer_position = coordinate_trait
- fill_padding
Fill the padding area with the background color?
fill_padding = Bool(False)
- hpadding
Readonly property expressing the total amount of horizontal padding
hpadding = Property
- id
The optional element ID of this component.
id = Str('')
- inset_border
Draw the border inset (on the plot)? If False, draw the border outside the plot area.
inset_border = Bool(True)
- invisible_layout
Does the component use space in the layout even if it is not visible?
invisible_layout = Bool(False)
- layout_needed
A read-only property that returns True if this component needs layout. It is a reflection of both the value of the component's private _layout_needed attribute as well as any logical layout dependencies with other components.
layout_needed = Property
- outer_bounds
The number of horizontal and vertical pixels in the padding outer box. Setting these bounds will modify the bounds of the component, but will not change the lower-left position (self.outer_position) or the padding. This returns a tuple because modifying the returned value has no effect. To modify outer_bounds element-wise, use set_outer_bounds().
outer_bounds = Property
- outer_height
outer_height = Property
- outer_position
The x,y point of the lower left corner of the padding outer box around the component. Setting this position will move the component, but will not change the padding or bounds. This returns a tuple because modifying the returned value has no effect. To modify outer_position element-wise, use set_outer_position().
outer_position = Property
- outer_width
outer_width = Property
- outer_x
outer_x = Property
- outer_x2
outer_x2 = Property
- outer_y
outer_y = Property
- outer_y2
outer_y2 = Property
- overlay_border
Draw the border as part of the overlay layer? If False, draw the border as part of the background layer.
overlay_border = Bool(True)
- overlays
A list of overlays for the plot. By default, overlays are drawn above the plot and its annotations.
overlays = List
- padding
This property allows a way to set the padding in bulk. It can either be set to a single Int (which sets padding on all sides) or a tuple/list of 4 Ints representing the left, right, top, bottom padding amounts. When it is read, this property always returns the padding as a list of four elements even if they are all the same.
padding = Property
- padding_accepts_focus
Does the component respond to mouse events over the padding area?
padding_accepts_focus = Bool(True)
- padding_bottom
The amount of space to put below the component
padding_bottom = Int(0)
- padding_left
The amount of space to put on the left side of the component
padding_left = Int(0)
- padding_right
The amount of space to put on the right side of the component
padding_right = Int(0)
- padding_top
The amount of space to put on top of the component
padding_top = Int(0)
- resizable
Dimensions that this component is resizable in. For resizable components, get_preferred_size() is called before their actual bounds are set.
- 'v': resizable vertically
- 'h': resizable horizontally
- 'hv': resizable horizontally and vertically
- '': not resizable
Note that this setting means only that the parent can and should resize this component; it does not mean that the component automatically resizes itself.
resizable = Enum('hv', 'h', 'v', '')
- underlays
A list of underlays for this plot. By default, underlays get a chance to draw onto the plot area underneath plot itself but above any images and backgrounds of the plot.
underlays = List
- unified_draw
If True, then this component draws as a unified whole, and its parent container calls this component's _draw() method when drawing the layer indicated by draw_layer. If False, it tries to cooperate in its container's layer-by-layer drawing. Its parent container calls self._dispatch_draw() with the name of each layer as it goes through its list of layers.
unified_draw = Bool(False)
- use_backbuffer
Should this component do a backbuffered draw, i.e. render itself to an offscreen buffer that is cached for later use? If False, then the component will never render itself backbuffered, even if asked to do so.
use_backbuffer = Bool(False)
- use_selection
Listen for changes to selection metadata on the underlying data sources, and render them specially?
use_selection = Bool(False)
- viewports
The list of viewport that are viewing this component
viewports = List(Instance('enthought.enable.viewport.Viewport'))
- visible
Is the component visible?
visible = Bool(True)
- vpadding
Readonly property expressing the total amount of vertical padding
vpadding = Property
- window
A reference to our top-level Enable Window. This is stored as a shadow attribute if this component is the direct child of the Window; otherwise, the getter function recurses up the containment hierarchy.
window = Property
Inherited from base classes
Method summary
- __init__(self, **traits)
- cleanup(self, window)
- 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)
- get_absolute_coords(self, *coords)
- get_preferred_size(self)
- invalidate_and_redraw(self)
- invalidate_draw(self, damaged_regions = None, self_relative = False)
- is_in(self, x, y)
- request_redraw(self)
- set_outer_bounds(self, ndx, val)
- set_outer_position(self, ndx, val)
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)
- 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)
- 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
- __init__(self, **traits)
- cleanup(self, window)
When a window viewing or containing a component is destroyed, cleanup is called on the component to give it the opportunity to delete any transient state it may have (such as backbuffers).
- dispatch(self, event, suffix)
Dispatches a mouse event based on the current event state.
Parameters
- event : an Enable MouseEvent
- A mouse event.
- suffix : string
- The name of the mouse event as a suffix to the event state name, e.g. "_left_down" or "_window_enter".
- do_layout(self, size = None, force = False)
Tells this component to do layout at a given size.
Parameters
- size : (width, height)
- Size at which to lay out the component; either or both values can be 0. If it is None, then the component lays itself out using bounds.
- force : Boolean
- Whether to force a layout operation. If False, the component does a layout on itself only if _layout_needed is True. The method always does layout on any underlays or overlays it has, even if force is False.
- draw(self, gc, view_bounds = None, mode = 'default')
Draws the plot component.
Parameters
- gc : Kiva GraphicsContext
- The graphics context to draw the component on
- view_bounds : 4-tuple of integers
- (x, y, width, height) of the area to draw
- mode : string
The drawing mode to use; can be one of:
- 'normal'
- Normal, antialiased, high-quality rendering
- 'overlay'
- The plot component is being rendered over something else, so it renders more quickly, and possibly omits rendering its background and certain tools
- 'interactive'
- The plot component is being asked to render in direct response to realtime user interaction, and needs to make its best effort to render as fast as possible, even if there is an aesthetic cost.
- draw_select_box(self, gc, position, bounds, width, dash, inset, color, bgcolor, marker_size)
Renders a selection box around the component.
Subclasses can implement this utility method to render a selection box around themselves. To avoid burdening subclasses with various selection-box related traits that they might never use, this method takes all of its required data as input parameters.
Parameters
- gc : Kiva GraphicsContext
- The graphics context to draw on.
- position : (x, y)
- The position of the selection region.
- bounds : (width, height)
- The size of the selection region.
- width : integer
- The width of the selection box border
- dash : float array
- An array of floating point values specifying the lengths of on and off painting pattern for dashed lines.
- inset : integer
- Amount by which the selection box is inset on each side within the selection region.
- color : 3-tuple of floats between 0.0 and 1.0
- The R, G, and B values of the selection border color.
- bgcolor : 3-tuple of floats between 0.0 and 1.0
- The R, G, and B values of the selection background.
- marker_size : integer
- Size, in pixels, of "handle" markers on the selection box
- get_absolute_coords(self, *coords)
Given coordinates relative to this component's origin, returns the "absolute" coordinates in the frame of the top-level parent Window enclosing this component's ancestor containers.
- Can be called in two ways:
- get_absolute_coords(x, y) get_absolute_coords( (x,y) )
Returns a tuple (x,y) representing the new coordinates.
- get_preferred_size(self)
Returns the size (width,height) that is preferred for this component
When called on a component that does not contain other components, this method just returns the component bounds. If the component is resizable and can draw into any size, the method returns a size that is visually appropriate. (The component's actual bounds are determined by its container's do_layout() method.)
- invalidate_and_redraw(self)
Convenience method to invalidate our contents and request redraw
- invalidate_draw(self, damaged_regions = None, self_relative = False)
Invalidates any backbuffer that may exist, and notifies our parents and viewports of any damaged regions.
Call this method whenever a component's internal state changes such that it must be redrawn on the next draw() call.
- is_in(self, x, y)
- request_redraw(self)
Requests that the component redraw itself. Usually this means asking its parent for a repaint.
- set_outer_bounds(self, ndx, val)
Since self.outer_bounds is a property whose value is determined by other (primary) attributes, it cannot return a mutable type. This method allows generic (i.e. orientation-independent) code to set the value of self.outer_bounds[0] or self.outer_bounds[1].
- set_outer_position(self, ndx, val)
Since self.outer_position is a property whose value is determined by other (primary) attributes, it cannot return a mutable type. This method allows generic (i.e. orientation-independent) code to set the value of self.outer_position[0] or self.outer_position[1].