Inherits from
- HasPrivateTraits: enthought.traits.has_traits.HasPrivateTraits
Attributes
- alt_down
A boolean value that specifies whether the alt key was being held down when a mouse event occurred.
alt_down = Bool(False)
- bitmap
The current bitmap to display on the feature bar.
bitmap = Property
- control_down
A boolean value that specifies whether the control key was being held down when a mouse event occurred.
control_down = Bool(False)
- dock_control
The DockControl instance associated with this feature. Note that features not directly associated with application components, and instead are associated with the DockControl object that manages an application component. The DockControl object provides the feature with access to information about the parent DockWindow object, other DockControl objects contained within the same DockWindow, as well as the application component. This trait is automatically set by the DockWindow when the feature instance is created and associated with an application component.
dock_control = Instance(DockControl)
- feature_name
A string value that is the user interface name of the feature as it should appear in the DockWindow Features sub-menu (e.g., 'Connect'). An empty string (the default) means that the feature does not appear in the Features sub-menu and cannot be enabled or disabled by the user. Avoid feature names that conflict with other, known features.
feature_name = ''
- image
The image (icon) to display on the feature bar. If None, no image is displayed. For images that never change, the value can be declared statically in the class definition. However, the feature is free to change the value at any time. Changing the value to a new ImageResource object causes the associated image to be updated on the feature bar. Setting the value to None removes the image from the feature bar.
image = Instance(ImageResource, allow_none = True)
- instances
List of weak references to all current instances.
instances = [ ]
- shift_down
A boolean value that specifies whether the shift key was being held down when a mouse event occurred.
shift_down = Bool(False)
- state
An integer that specifies th current state of the feature (0 = uninstalled, 1 = active, 2 = disabled). Usually you do not need to change this value explicitly; DockWindows normally manages the value automatically, setting it when the user enables or disables the feature.
state = 0
- tooltip
The tooltip to display when the pointer hovers over the image. The value can be changed dynamically to reflect changes in the feature's state.
tooltip = Str
- x
The x-coordinate of a pointer event that occurred over the feature's image. This can be used in cases where the event-handling for a feature is sensitive to the position of the pointer relative to the feature image. This is not normally the case, but the information is available if it is needed.
x = Int
- y
The y-coordinate of a pointer event that occurred over the feature's image.
y = Int
Inherited from base classes
Method summary
- add_to_menu(self, menu_item)
- add_to_toolbar(self, toolbar_item)
- alt_drag(self)
- alt_right_drag(self)
- can_add_to_menu(self, action)
- can_add_to_toolbar(self, action)
- can_drop(self, object)
- click(self)
- control_drag(self)
- control_right_drag(self)
- disable(self)
- dispose(self)
- drag(self)
- drop(self, object)
- enable(self)
- feature_for(cls, dock_control)
- is_feature_for(self, dock_control)
- new_feature(cls, dock_control)
- new_feature_for(cls, dock_control)
- perform(self, action)
- popup_menu(self, menu)
- quick_drag(self)
- quick_right_drag(self)
- refresh(self)
- right_click(self)
- right_drag(self)
- shift_control_drag(self)
- shift_drag(self)
- toggle_feature(cls, event)
Inherited from base classes
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name)
- __reduce_ex__(self, protocol)
- __setstate__(self, state)
- 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)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- get(self, *names, **metadata)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same')
- print_traits(self, show_help = False, **metadata)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- reset_traits(self, traits = None, **metadata)
- set(self, trait_change_notify = True, **traits)
- 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_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- 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
- add_to_toolbar(self, toolbar_item)
Adds a tool bar item to the tool bar being constructed.
- alt_drag(self)
Returns the object to be dragged when the user drags a feature image while pressing the 'Alt' key.
This method is designed to be overridden by subclasses. If Alt-dragging is supported by the feature, then the method returns the object to be dragged; otherwise it returns None. The default implementation returns None.
- alt_right_drag(self)
Returns the object to be dragged when the user right mouse button drags a feature image while pressing the 'Alt' key.
This method is designed to be overridden by subclasses. If right Alt-dragging is supported by the feature, then the method returns the object to be dragged; otherwise it returns None. The default implementation returns None.
- can_add_to_toolbar(self, action)
Returns whether the toolbar action should be defined in the user interface.
- can_drop(self, object)
Returns whether a specified object can be dropped on a feature image.
Parameters
- object : any object
- The object being dragged onto the feature image
Returns
True if object is a valid object for the feature to process; False otherwise.
Description
This method is designed to be overridden by subclasses. It is called whenever the user drags an icon over the feature's tab or drag bar image. The method does not perform any processing on object; it only examines it. Processing of the object occurs in the drop() method, which is called when the user release the object over the feature's image, which typically occurs after the can_drop() method has indicated that the feature can process the object, by returning True. The default implementation returns False, indicating that the feature does not accept any objects for dropping.
- click(self)
Handles the user left-clicking on a feature image.
This method is designed to be overridden by subclasses. The default implementation attempts to perform a 'quick drag' operation (see the 'quick_drag' method). Returns nothing.
- control_drag(self)
Returns the object to be dragged when the user drags a feature image while pressing the 'Ctrl' key.
This method is designed to be overridden by subclasses. If control-dragging is supported by the feature, then the method returns the object to be dragged; otherwise it returns None. The default implementation returns None.
- control_right_drag(self)
Returns the object to be dragged when the user right mouse button drags a feature image while pressing the 'Ctrl' key.
This method is designed to be overridden by subclasses. If right control-dragging is supported by the feature, then the method returns the object to be dragged; otherwise it returns None. The default implementation returns None.
- disable(self)
Disables the feature.
Returns
Nothing.
Description
This helper method temporarily disables the feature for the associated application component. The feature can be re-enabled by calling the enable() method. Disabling the feature removes the feature's icon from the feature bar, without actually deleting the feature (i.e., the dispose() method is not called).
- dispose(self)
Performs any clean-up needed when the feature is removed from its associated application component (for example, when the user disables the feature).
This method is designed to be overridden by subclasses. The method performs any clean-up actions needed by the feature, such as closing files, removing trait listeners, and so on. The method does not return a result. The default implementation does nothing.
- drag(self)
Returns the object to be dragged when the user drags a feature image.
This method can be overridden by subclasses. If dragging is supported by the feature, then the method returns the object to be dragged; otherwise it returns None. The default implementation returns None.
- drop(self, object)
Handles the user dropping a specified object on a feature image.
Parameters
- object : any object
- The object being dropped onto the feature image
Returns
Nothing.
Description
This method is designed to be overridden by subclasses. It is called whenever the user drops an object on the feature's tab or drag bar image. This method can be called only if a previous call to can_drop() for the same object returned True. The default implementation does nothing.
- enable(self)
Enables the feature.
Returns
Nothing.
Description
This helper method re-enables a previously disabled feature for its associated application component. Enabling a feature restores the feature bar icon that the feature displayed at the time it was disabled.
- feature_for(cls, dock_control)
Returns a single new feature object or list of new feature objects for a specified DockControl.
Parameters
- dock_control : enthought.pyface.dock.api.DockControl
- The DockControl object that corresponds to the application component being added, or for which the feature is being enabled.
Returns
An instance or list of instances of this class that will be associated with the application component; None if the feature does not apply to the application component.
Description
This class method is designed to be overridden by subclasses. Normally, a feature class determines whether it applies to an application component by examining the component to see if it is an instance of a certain class, supports a specified interface, or has trait attributes with certain types of metadata. The application component is available through the dock_control.object trait attribute. Note that it is possible for dock_control.object to be None.
The default implementation for this method calls the is_feature_for() class method to determine whether the feature applies to the specified DockControl. If it does, it calls the new_feature() class method to create the feature instances to be returned. If it does not, it simply returns None.
- is_feature_for(self, dock_control)
Returns whether this class is a valid feature for the application object corresponding to a specified DockControl.
Parameters
- dock_control : enthought.pyface.dock.api.DockControl
- The DockControl object that corresponds to the application component being added, or for which the feature is being enabled.
Returns
True if the feature applies to the application object associated with the dock_control; False otherwise.
Description
This class method is designed to be overridden by subclasses. It is called by the default implementation of the feature_for() class method to determine whether the feature applies to the application object specified by dock_control. The default implementation always returns True.
- new_feature(cls, dock_control)
Returns a new feature instance for a specified DockControl.
Parameters
- dock_control : enthought.pyface.dock.api.DockControl
- The DockControl object that corresponds to the application component being added, or for which the feature is being enabled.
Returns
An instance or list of instances of this class to be associated with the application component; it can also return None.
Description
This method is designed to be overridden by subclasses. This method is called by the default implementation of the feature_for() class method to create the feature instances to be associated with the application component specified by dock_control. The default implementation returns the result of calling the class constructor as follows:
cls( dock_control=dock_control )
- new_feature_for(cls, dock_control)
Returns a feature object for use with the specified DockControl (or None if the feature does not apply to the DockControl object).
- perform(self, action)
Performs the action described by a specified Action object.
- quick_drag(self)
Performs a quick drag and drop operation by displaying a pop-up menu containing all targets that the feature's xxx_drag() method can be dropped on. Selecting an item drops the item on the selected target.
- quick_right_drag(self)
Performs a quick drag and drop operation with the right mouse button by displaying a pop-up menu containing all targets that the feature's xxx_right_drag() method can be dropped on. Selecting an item drops the item on the selected target.
- refresh(self)
Refreshes the display of the feature image.
Returns
Nothing.
Description
This helper method requests the containing DockWindow to refresh the feature bar.
- right_click(self)
Handles the user right-clicking on a feature image.
This method is designed to be overridden by subclasses. The default implementation attempts to perform a 'quick drag' operation (see the 'quick_right_drag' method). Returns nothing. Typically, you override this method to display the feature's shortcut menu.
- right_drag(self)
Returns the object to be dragged when the user right mouse button drags a feature image.
This method can be overridden by subclasses. If right dragging is supported by the feature, then the method returns the object to be dragged; otherwise it returns None. The default implementation returns None.
- shift_control_drag(self)
Returns the object to be dragged when the user right mouse button drags a feature image while pressing the 'Shift' key.
This method is designed to be overridden by subclasses. If right shift-dragging is supported by the feature, then the method returns the object to be dragged; otherwise it returns None. The default implementation returns None.
- shift_drag(self)
Returns the object to be dragged when the user drags a feature image while pressing the 'Shift' key.
This method is designed to be overridden by subclasses. If shift-dragging is supported by the feature, then the method returns the object to be dragged; otherwise it returns None. The default implementation returns None.
- toggle_feature(cls, event)
Toggles the feature on or off.