import logging
-from .ui import CloseEngine, CommandMessage
+
+class QueueMessage (object):
+ def __str__(self):
+ return self.__class__.__name__
+
+
+class CloseEngine (QueueMessage):
+ pass
+
+
+class CommandMessage (QueueMessage):
+ """A message storing a command to run, `command` should be a
+ :class:`hooke.command.Command` instance, and `arguments` should be
+ a :class:`dict` with `argname` keys and `value` values to be
+ passed to the command.
+ """
+ def __init__(self, command, arguments=None):
+ self.command = command
+ if arguments == None:
+ arguments = {}
+ self.arguments = arguments
class CommandEngine (object):
def run(self, hooke, ui_to_command_queue, command_to_ui_queue):
- """Get a :class:`hooke.ui.QueueMessage` from the incoming
+ """Get a :class:`QueueMessage` from the incoming
`ui_to_command_queue` and act accordingly.
- If the message is a :class:`hooke.ui.CommandMessage` instance,
- the command run may read subsequent input from
+ If the message is a :class:`CommandMessage` instance, the
+ command run may read subsequent input from
`ui_to_command_queue` (if it is an interactive command). The
command may also put assorted data into `command_to_ui_queue`.
When the command completes, it will put a
:class:`hooke.command.CommandExit` instance into
`command_to_ui_queue`, at which point the `CommandEngine` will
- be ready to receive the next :class:`hooke.ui.QueueMessage`.
+ be ready to receive the next :class:`QueueMessage`.
"""
log = logging.getLogger('hooke')
while True:
# License along with Hooke. If not, see
# <http://www.gnu.org/licenses/>.
-"""Records, saves and executes batches of commands
+"""The ``command_stack`` module provides :class:`CommandStackPlugin`
+and several associated :class:`~hooke.command.Command`\s for managing
+stacks of :class:`~hooke.engine.CommandMessage`\s and applying those
+stacks to :class:`~hooke.curve.Curve`\s.
"""
import os.path
from .. import version
from ..config import Setting
+from ..engine import CloseEngine, CommandMessage
from ..util.pluggable import IsSubclass, construct_odict
try:
"""
-class QueueMessage (object):
- def __str__(self):
- return self.__class__.__name__
-
-class CloseEngine (QueueMessage):
- pass
-
-class CommandMessage (QueueMessage):
- """A message storing a command to run, `command` should be a
- :class:`hooke.command.Command` instance, and `arguments` should be
- a :class:`dict` with `argname` keys and `value` values to be
- passed to the command.
- """
- def __init__(self, command, arguments=None):
- self.command = command
- if arguments == None:
- arguments = {}
- self.arguments = arguments
-
class UserInterface (object):
"""A user interface to drive the :class:`hooke.engine.CommandEngine`.
"""
import shlex
from ..command import CommandExit, Exit, Command, Argument, StoreValue
+from ..engine import CommandMessage
from ..interaction import Request, BooleanRequest, ReloadUserInterfaceConfig
-from ..ui import UserInterface, CommandMessage
+from ..ui import UserInterface
from ..util.convert import from_string
from ..util.encoding import get_input_encoding, get_output_encoding
from ...command import CommandExit, Exit, Success, Failure, Command, Argument
from ...config import Setting
+from ...engine import CommandMessage
from ...interaction import Request, BooleanRequest, ReloadUserInterfaceConfig
-from ...ui import UserInterface, CommandMessage
+from ...ui import UserInterface
from .dialog.selection import Selection as SelectionDialog
from .dialog.save_file import select_save_file
from . import menu as menu
"""Commands and settings panel for Hooke.
This panel handles command generation of
-:class:`hooke.ui.CommandMessage`\s for all of the commands that don't
-have panels of their own. Actually it can generate
-:class:`hooke.ui.CommandMessage`\s for those as well, but the
+:class:`hooke.engine.CommandMessage`\s for all of the commands that
+don't have panels of their own. Actually it can generate
+:class:`hooke.engine.CommandMessage`\s for those as well, but the
command-specific panel will probably have a nicer interface.
# TODO: command arguments.