envisage.ui.tasks.tasks_application module

envisage.ui.tasks.tasks_application.DEFAULT_STATE_FILENAME = 'application_memento'

Default filename for saving layout information

class envisage.ui.tasks.tasks_application.TasksApplication(plugins=None, **traits)[source]

Bases: Application

The entry point for an Envisage Tasks application.

This class handles the common case for Tasks applications and is intended to be subclassed to modify its start/stop behavior, etc.

TASK_EXTENSIONS = 'envisage.ui.tasks.task_extensions'

Extension point ID for task extensions

TASK_FACTORIES = 'envisage.ui.tasks.tasks'

Extension point ID for task factories

active_window = Instance("envisage.ui.tasks.task_window.TaskWindow")

The active task window (the last one to get focus).

always_use_default_layout = Bool(False)

Whether to always apply the default application level layout when the application is started. Even if this is True, the layout state of individual tasks will be restored.

application_exiting = Event

Fired immediately before the extant windows are destroyed and the GUI event loop is terminated.

application_initialized = Event

Fired after the initial windows have been created and the GUI event loop has been started.

create_task(id)[source]

Creates the Task with the specified ID.

Returns:

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

Return type:

pyface.tasks.task.Task

create_window(layout=None, restore=True, **traits)[source]

Creates a new TaskWindow, possibly with some Tasks.

Parameters:
  • layout (TaskWindowLayout, optional) – The layout to use for the window. The tasks described in the layout will be created and added to the window automatically. If not specified, the window will contain no tasks.

  • restore (bool, optional (default True)) – If set, the application will restore old size and positions for the window and its panes, if possible. If a layout is not provided, this parameter has no effect.

  • **traits (dict, optional) – Additional parameters to pass to window_factory() when creating the TaskWindow.

Returns:

The new TaskWindow.

Return type:

envisage.ui.tasks.task_window.TaskWindow

default_layout = List(

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

exit(force=False)[source]

Exits the application, closing all open task windows.

Each window is sent a veto-able closing event. If any window vetoes the close request, no window will be closed. Otherwise, all windows will be closed and the GUI event loop will terminate.

This method is not called when the user clicks the close button on a window or otherwise closes a window through his or her window manager. It is only called via the File->Exit menu item. It can also, of course, be called programatically.

Parameters:

force (bool, optional (default False)) – If set, windows will receive no closing events and will be destroyed unconditionally. This can be useful for reliably tearing down regression tests, but should be used with caution.

Returns:

A boolean indicating whether the application exited.

Return type:

bool

gui = Instance("pyface.i_gui.IGUI")

The Pyface GUI for the application.

icon = Instance("pyface.image_resource.ImageResource", allow_none=True)

Icon for the whole application. Will be used to override all taskWindows icons to have the same.

layout_save_protocol = Int(4)

Pickle protocol to use for persisting layout information.

name = Str

The name of the application (also used on window title bars).

run()[source]

Run the application.

Returns:

Whether the application started successfully (i.e., without a veto).

Return type:

bool

splash_screen = Instance("pyface.splash_screen.SplashScreen")

The splash screen for the application. By default, there is no splash screen.

state_filename = Str(DEFAULT_STATE_FILENAME)

The filename that the application uses to persist window layout information.

state_location = Directory

The directory on the local file system used to persist window layout information.

task_extensions = ExtensionPoint(id=TASK_EXTENSIONS)

Contributed task extensions.

task_factories = ExtensionPoint(id=TASK_FACTORIES)

Contributed task factories. This attribute is primarily for run-time inspection; to instantiate a task, use the ‘create_task’ method.

window_closed = Event(

Fired when a task window has been closed.

window_closing = Event(

Fired when a task window is closing.

window_created = Event(

Fired when a task window has been created.

window_factory = Callable

The factory for creating task windows.

window_opened = Event(

Fired when a task window has been opened.

window_opening = Event(

Fired when a task window is opening.

windows = List(Instance("envisage.ui.tasks.task_window.TaskWindow"))

The list of task windows created by the application.

class envisage.ui.tasks.tasks_application.TasksApplicationState[source]

Bases: HasStrictTraits

A class used internally by TasksApplication for saving and restoring application state.

get_equivalent_window_layout(window_layout)[source]

Gets an equivalent TaskWindowLayout, if there is one.

get_task_layout(task_id)[source]

Gets a TaskLayout with the specified ID, there is one.

push_window_layout(window_layout)[source]

Merge a TaskWindowLayout into the accumulated list.