Skip to content
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
Enable Apptools Integration
===========================

Apptools (https://github.com/enthought/apptools) is a library of useful code
for building GUI applications. It includes code for features like preferences,
undo/redo support, and selection management.

Enable doesn't require Apptools, but developers working within the apptools
ecosystem may want to integrate Enable interactions with undo/redo and
selections.

Undo/Redo Support
-----------------
=================

The `enable.tools.apptools` package has a number of modules that provide
classes for working with Apptool's Undo/Redo stack. This permits Enable
The `enable.tools.pyface` package has a number of modules that provide
classes for working with Pyface's Undo/Redo stack. This permits Enable
tools to add Commands to the Undo/Redo stack, and provides variants of the
MoveTool and ResizeTool that are undoable.

In addition, a tool is provided which binds keystrokes to send undo and
redo requests to the apptools UndoManager.
redo requests to the Pyface UndoManager.

High-Level Tools
~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Enable Documentation
enable_key_events.rst
enable_basic_tools.rst
enable_drag_and_drop.rst
enable_apptools_integration.rst
enable_undo_redo.rst

kiva.rst
credits.rst
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Local library imports
from enable.component import Component
from enable.testing import EnableTestAssistant
from enable.tools.apptools.commands import (
from enable.tools.pyface.commands import (
ComponentCommand, MoveCommand, ResizeCommand)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
from unittest.mock import MagicMock

# Enthought library imports
from apptools.undo.api import CommandStack
from pyface.undo.api import CommandStack
from traits.testing.unittest_tools import UnittestTools

# Local library imports
from enable.component import Component
from enable.container import Container
from enable.testing import EnableTestAssistant
from enable.tools.apptools.commands import MoveCommand, ResizeCommand
from enable.tools.apptools.move_command_tool import MoveCommandTool
from enable.tools.pyface.commands import MoveCommand, ResizeCommand
from enable.tools.pyface.move_command_tool import MoveCommandTool


class MoveCommandToolTestCase(unittest.TestCase, EnableTestAssistant,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
from unittest.mock import MagicMock

# Enthought library imports
from apptools.undo.api import CommandStack
from pyface.undo.api import CommandStack
from traits.testing.unittest_tools import UnittestTools

# Local library imports
from enable.component import Component
from enable.container import Container
from enable.testing import EnableTestAssistant
from enable.tools.apptools.commands import ResizeCommand
from enable.tools.apptools.resize_command_tool import ResizeCommandTool
from enable.tools.pyface.commands import ResizeCommand
from enable.tools.pyface.resize_command_tool import ResizeCommandTool


class ResizeCommandToolTestCase(unittest.TestCase, EnableTestAssistant,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
from unittest.mock import MagicMock

# Enthought library imports
from apptools.undo.api import UndoManager
from pyface.undo.api import UndoManager
from traits.testing.unittest_tools import UnittestTools

# Local library imports
from enable.base_tool import KeySpec
from enable.component import Component
from enable.testing import EnableTestAssistant
from enable.tools.apptools.undo_tool import UndoTool
from enable.tools.pyface.undo_tool import UndoTool


class UndoToolTestCase(unittest.TestCase, EnableTestAssistant, UnittestTools):
Expand Down
17 changes: 17 additions & 0 deletions enable/tools/apptools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# (C) Copyright 2015 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
import warnings

warnings.warn(
("apptools.undo is deprecated and will be removed in a future release. The"
" functionality is now available via pyface.undo. As a result,"
" enable.tools.apptools has been deprecated in favor of"
" enable.tools.pyface."),
DeprecationWarning,
stacklevel=2
)
Comment thread
jwiggins marked this conversation as resolved.
20 changes: 1 addition & 19 deletions enable/tools/apptools/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,5 @@
# LICENSE.txt
#

"""
Enable Apptools Integration
===========================

Apptools (https://github.com/enthought/apptools) is a library of useful code
for building GUI applications. It includes code for features like preferences,
undo/redo support, and seelction management.

The code in this sub-package helps applications interface with the
functionality provided by Apptools, but is optional from the point of view
of the Enable codebase as a whole.

"""

# Support for Undo/Redo with Enable
from .commands import ComponentCommand, MoveCommand, ResizeCommand
from .command_tool import BaseCommandTool, BaseUndoTool
from .move_command_tool import MoveCommandTool
from .resize_command_tool import ResizeCommandTool
from .undo_tool import UndoTool
from enable.tools.pyface.api import * # noqa: F401,F403
14 changes: 14 additions & 0 deletions enable/tools/pyface/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# (C) Copyright 2015 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
Comment thread
jwiggins marked this conversation as resolved.

# Support for Undo/Redo with Enable
from .commands import ComponentCommand, MoveCommand, ResizeCommand
from .command_tool import BaseCommandTool, BaseUndoTool
from .move_command_tool import MoveCommandTool
from .resize_command_tool import ResizeCommandTool
from .undo_tool import UndoTool
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
Command Tools
=============

This module provides classes for tools that work with Apptools' Undo/Redo
This module provides classes for tools that work with Pyface's Undo/Redo
Command stack.

"""

from apptools.undo.api import ICommandStack, IUndoManager
from pyface.undo.api import ICommandStack, IUndoManager
from traits.api import Callable, Instance

from enable.base_tool import BaseTool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
Enable Commands
===============

This module provides :py:class:`apptools.undo.abstract_command.AbstractCommand`
This module provides :py:class:`pyface.undo.abstract_command.AbstractCommand`
subclasses for common component manipulations, such as moving, resizing and
setting attribute values.

"""

from apptools.undo.api import AbstractCommand
from pyface.undo.api import AbstractCommand
from traits.api import Bool, Instance, Tuple, Unicode
from traits.util.camel_case import camel_case_to_words

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
MoveCommandTool
===============

A MoveTool that uses AppTools' undo/redo infrastructure to create undoable move
A MoveTool that uses Pyface's undo/redo infrastructure to create undoable move
commands.

"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ResizeCommandTool
=================

A CommandTool that uses AppTools' undo/redo infrastructure to create undoable
A CommandTool that uses Pyface's undo/redo infrastructure to create undoable
resize commands.

"""
Expand Down
File renamed without changes.
8 changes: 2 additions & 6 deletions examples/enable/tools/button_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
#

"""
Undoable Move Tool
==================

This example shows how to integrate a simple component move tool with apptools
undo/redo infrastructure.

Button Tool
===========
"""

from traits.api import Bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
Undoable Move Tool
==================

This example shows how to integrate a simple component move tool with apptools
This example shows how to integrate a simple component move tool with pyface
undo/redo infrastructure.

"""

from apptools.undo.api import (CommandStack, ICommandStack, IUndoManager,
from pyface.undo.api import (CommandStack, ICommandStack, IUndoManager,
UndoManager)
from apptools.undo.action.api import UndoAction, RedoAction
from pyface.undo.action.api import UndoAction, RedoAction
from pyface.action.api import Action, Group, MenuBarManager, MenuManager
from traits.api import Instance

from enable.api import Container, Window, KeySpec
from enable.example_application import DemoApplication, demo_main
from enable.primitives.api import Box
from enable.tools.apptools.api import MoveCommandTool, UndoTool
from enable.tools.pyface.api import MoveCommandTool, UndoTool


class UndoableMoveApplication(DemoApplication):
Expand All @@ -35,7 +35,7 @@ class UndoableMoveApplication(DemoApplication):

"""

#: The apptools undo manager the application uses.
#: The pyface undo manager the application uses.
undo_manager = Instance(IUndoManager)

#: The command stack that the MoveCommandTool will use.
Expand Down