enable.trait_defs.ui.editor_with_component module

class enable.trait_defs.ui.editor_with_component.Editor(parent, **traits)[source]

Bases: traitsui.editor.Editor

Base class for PyQt editors for Traits-based UIs.

add_to_menu(menu_item)[source]

Adds a menu item to the menu bar being constructed.

can_add_to_menu(action)[source]

Returns whether the action should be defined in the user interface.

clear_layout()[source]

Delete the contents of a control’s layout.

eval_when(condition, object, trait)[source]

Evaluates a condition within a defined context, and sets a specified object trait based on the result, which is assumed to be a Boolean.

get_control_widget()[source]

Get the concrete widget for the control.

Some editors may use a QLayout instead of a Qwidget, which may not be suitable for certain usages (eg. for parenting other widgets).

get_error_control()[source]

Returns the editor’s control for indicating error status.

in_error_state()[source]

Returns whether or not the editor is in an error state.

perform(action, action_event=None)[source]

Performs the action described by a specified Action object.

set_error_state(state=None, control=None)[source]

Sets the editor’s current error state.

set_focus()[source]

Assigns focus to the editor’s underlying toolkit widget.

set_size_policy(direction, resizable, springy, stretch)[source]

Set the size policy of the editor’s controller.

Based on the “direction” of the group that contains this editor (VGroup or HGroup), set the stretch factor and the resizing policy of the control.

Parameters
  • direction (QtGui.QBoxLayout.Direction) – Directionality of the group that contains this editor. Either QtGui.QBoxLayout.Direction.LeftToRight or QtGui.QBoxLayout.Direction.TopToBottom

  • resizable (bool) – True if control should be resizable in the orientation opposite to the group directionality

  • springy (bool) – True if control should be resizable in the orientation equal to the group directionality

  • stretch (int) – Stretch factor used by Qt to distribute the total size to each component.

set_tooltip_text(control, text)[source]

Sets the tooltip for a specified control.

update_editor()[source]

Updates the editor when the object trait changes externally to the editor.

class enable.trait_defs.ui.editor_with_component.EditorWithComponent(parent, **traits)[source]

Bases: traitsui.qt4.editor.Editor

Base class for editors which hold a Component that displays the value.

This is distinct from CompononentEditor in that the value is not the Component.

component = Instance(Component)

The component that is created by the UI.

create_component()[source]
create_window(parent, size)[source]
dispose()[source]

Disposes of the contents of an editor.

This disconnects any synchronised values and resets references to other objects.

Subclasses may chose to override this method to perform additional clean-up.

init(parent)[source]

Create and initialize the underlying toolkit widget.

This method must be overriden by subclasses. Implementations must ensure that the control trait is set to an appropriate toolkit object.

Parameters

parent (toolkit control) – The parent toolkit object of the editor’s toolkit objects.

window = Instance(Window)

The window that displays the component.

class enable.trait_defs.ui.editor_with_component.EditorWithLabelComponent(parent, **traits)[source]

Bases: enable.trait_defs.ui.editor_with_component.EditorWithComponent

A class that creates a Label component.

By default it displays the string representation of the value.

create_component()[source]

Creates the label component.

font = font_trait()

The font to use for the label.

set_size_policy(direction, resizable, springy, stretch)[source]

Set the size policy of the editor’s component.

This is only used by the Qt backend. This is always springy and resizable.

update_editor()[source]

Updates the editor when the object trait changes externally to the editor.

update_font(event)[source]