Added CurveEngine.run_command and reorganized CommandStack._execute
[hooke.git] / hooke / engine.py
index 90c652ed47f40bbee51ceb3f53dd93257a6235f1..b4381298178f59723b540cfc901a7968ac93e1c1 100644 (file)
@@ -22,6 +22,8 @@
 
 import logging
 
+from .command import NullQueue
+
 
 class QueueMessage (object):
     def __str__(self):
@@ -73,3 +75,15 @@ class CommandEngine (object):
             log.debug('engine running %s' % msg.command.name)
             msg.command.run(hooke, ui_to_command_queue, command_to_ui_queue,
                             **msg.arguments)
+
+    def run_command(self, hooke, command, arguments):
+        """Internal command execution.
+
+        This allows commands to execute sub commands and enables
+        :class:`~hooke.command_stack.CommandStack` execution.
+
+        Note that these commands *do not* have access to the usual UI
+        communication queues, so make sure they will not need user
+        interaction.
+        """
+        command.run(hooke, NullQueue(), NullQueue(), arguments)