X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=hooke%2Fengine.py;h=ca4461d9bc6800de936b6f740d667ca02c7c969a;hb=fdf4a81ce1eaf89dd741dbd6150a2827e4e9daee;hp=a973730f65a4af3c422bff3951dc96605f58c250;hpb=7762de28cee60f98882d72db0c2ae2c6009ac465;p=hooke.git diff --git a/hooke/engine.py b/hooke/engine.py index a973730..ca4461d 100644 --- a/hooke/engine.py +++ b/hooke/engine.py @@ -2,15 +2,15 @@ # # 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 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. +# 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 @@ -20,8 +20,11 @@ :class:`hooke.command.Command`\s. """ +import logging + from .ui import CloseEngine, CommandMessage + class CommandEngine (object): def run(self, hooke, ui_to_command_queue, command_to_ui_queue): """Get a :class:`hooke.ui.QueueMessage` from the incoming @@ -37,11 +40,16 @@ class CommandEngine (object): `command_to_ui_queue`, at which point the `CommandEngine` will be ready to receive the next :class:`hooke.ui.QueueMessage`. """ + log = logging.getLogger('hooke') while True: + log.debug('engine waiting for command') msg = ui_to_command_queue.get() if isinstance(msg, CloseEngine): command_to_ui_queue.put(hooke) + log.debug( + 'engine closing, placed hooke instance in return queue') break assert isinstance(msg, CommandMessage), type(msg) + log.debug('engine running %s' % msg.command.name) msg.command.run(hooke, ui_to_command_queue, command_to_ui_queue, **msg.arguments)