pyface.tasks.i_editor_area_pane module

class pyface.tasks.i_editor_area_pane.IEditorAreaPane(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]

Bases: ITaskPane

A central pane that contains tabbed editors.

There are currently two implementations of this interface in Tasks. EditorAreaPane provides a simple, tabbed editor area. AdvancedEditorAreaPane additionally permits arbitrary splitting of the editor area so that editors can be displayed side-by-side.

active_editor = Instance(IEditor)

The currently active editor.

editors = List(IEditor)

The list of all the visible editors in the pane.

file_drop_extensions = List(Str)

A list of extensions for file types to accept via drag and drop. Note: This functionality is provided because it is very common, but drag and drop support is in general highly toolkit-specific. If more sophisticated support is required, subclass an editor area implementation.

file_dropped = Event(File)

A file with a supported extension was dropped into the editor area.

hide_tab_bar = Bool(False)

Whether to hide the tab bar when there is only a single editor.

activate_editor(editor)[source]

Activates the specified editor in the pane.

add_editor(editor)[source]

Adds an editor to the pane.

create_editor(obj, factory=None)[source]

Creates an editor for an object.

If a factory is specified, it will be used instead of the editor factory registry. Otherwise, this method will return None if a suitable factory cannot be found in the registry.

Note that the editor is not added to the pane.

edit(obj, factory=None, use_existing=True)[source]

Edit an object.

This is a convenience method that creates and adds an editor for the specified object. If ‘use_existing’ is set and the object is already being edited, then that editor will be activated and a new editor will not be created.

Returns the (possibly new) editor for the object.

get_editor(obj)[source]

Returns the editor for an object.

Returns None if the object is not being edited.

get_factory(obj)[source]

Returns an editor factory suitable for editing an object.

Returns None if there is no such editor factory.

register_factory(factory, filter)[source]

Registers a factory for creating editors.

The ‘factory’ parameter is a callabe of form:

callable(editor_area=editor_area, obj=obj) -> IEditor

Often, factory will be a class that provides the ‘IEditor’ interface.

The ‘filter’ parameter is a callable of form:

callable(obj) -> bool

that indicates whether the editor factory is suitable for an object.

If multiple factories apply to a single object, it is undefined which factory is used. On the other hand, multiple filters may be registered for a single factory, in which case only one must apply for the factory to be selected.

remove_editor(editor)[source]

Removes an editor from the pane.

unregister_factory(factory)[source]

Unregisters a factory for creating editors.

class pyface.tasks.i_editor_area_pane.MEditorAreaPane[source]

Bases: HasTraits

create_editor(obj, factory=None)[source]

Creates an editor for an object.

edit(obj, factory=None, use_existing=True)[source]

Edit an object.

get_editor(obj)[source]

Returns the editor for an object.

get_factory(obj)[source]

Returns an editor factory suitable for editing an object.

register_factory(factory, filter)[source]

Registers a factory for creating editors.

unregister_factory(factory)[source]

Unregisters a factory for creating editors.