Moved contact point detection from plugin.fit -> plugin.vclamp.
[hooke.git] / hooke / engine.py
index a03a2a4228ba3b4fafbf8d75ecbfb7e0a5ba8dce..a973730f65a4af3c422bff3951dc96605f58c250 100644 (file)
@@ -1,3 +1,21 @@
+# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+#
+# This file is part of Hooke.
+#
+# Hooke is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation, either
+# version 3 of the License, or (at your option) any later version.
+#
+# Hooke is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Hooke.  If not, see
+# <http://www.gnu.org/licenses/>.
+
 """The `engine` module provides :class:`CommandEngine` for executing
 :class:`hooke.command.Command`\s.
 """
@@ -5,7 +23,7 @@
 from .ui import CloseEngine, CommandMessage
 
 class CommandEngine (object):
-    def run(self, ui_to_command_queue, command_to_ui_queue):
+    def run(self, hooke, ui_to_command_queue, command_to_ui_queue):
         """Get a :class:`hooke.ui.QueueMessage` from the incoming
         `ui_to_command_queue` and act accordingly.
 
@@ -22,7 +40,8 @@ class CommandEngine (object):
         while True:
             msg = ui_to_command_queue.get()
             if isinstance(msg, CloseEngine):
+                command_to_ui_queue.put(hooke)
                 break
             assert isinstance(msg, CommandMessage), type(msg)
-            msg.command.run(ui_to_command_queue, command_to_ui_queue,
+            msg.command.run(hooke, ui_to_command_queue, command_to_ui_queue,
                             **msg.arguments)