pyface.tasks.tasks_application module

Define a base Task application class to create the event loop, and launch the creation of tasks and corresponding windows.

class pyface.tasks.tasks_application.TaskFactory[source]

Bases: HasStrictTraits

A factory for creating a Task with some additional metadata.

id = Str()

The task factory’s unique identifier. This ID is assigned to all tasks created by the factory.

name = Str()

The task factory’s user-visible name.

factory = Callable

A callable with the following signature:

callable(**traits) -> Task

Often this attribute will simply be a Task subclass.

create(**traits)[source]

Creates the Task.

The default implementation simply calls the ‘factory’ attribute.

class pyface.tasks.tasks_application.TasksApplication[source]

Bases: GUIApplication

A base class for Pyface tasks applications.

tasks = List(Instance("pyface.tasks.task.Task"))

List of all running tasks

active_task = Property(

Currently active Task if any.

task_factories = List()

List of all application task factories.

default_layout = List(

The default layout for the application. If not specified, a single window will be created with the first available task factory.

extra_actions = List(

Hook to add global schema additions to tasks/windows

extra_dock_pane_factories = List(Callable)

Hook to add global dock pane additions to tasks/windows

create_task(id)[source]

Creates the Task with the specified ID.

Parameters

id (str) – The id of the task factory to use.

Return type

The new Task, or None if there is not a suitable TaskFactory.

create_window(layout=None, **kwargs)[source]

Connect task to application and open task in a new window.

Parameters
  • layout (TaskLayout or None) – The pane layout for the window.

  • **kwargs (dict) – Additional keyword arguments to pass to the window factory.

Returns

window – The new TaskWindow.

Return type

ITaskWindow or None