Lowercase initial word in some log messages.
[hooke.git] / hooke / ui / __init__.py
index d70bd41425334c4c0b75bac1ff9ccde3fe03f7f3..02e91513238b299d65790799a96bff330b9d4104 100644 (file)
 """
 
 import ConfigParser as configparser
+import logging
 
 from .. import version
-from ..license import short_license
 from ..config import Setting
 from ..util.pluggable import IsSubclass, construct_odict
 
+try:
+    from ..license import short_license
+except ImportError, e:
+    logging.warn('could not load short_license from hooke.license')
+    from .. import __license__
+    def short_license(extra_info, **kwargs):
+        return __license__
+
 
 USER_INTERFACE_MODULES = [
     'commandline',
@@ -39,25 +47,6 @@ USER_INTERFACE_SETTING_SECTION = 'user interfaces'
 """
 
 
-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`.
     """
@@ -93,6 +82,11 @@ class UserInterface (object):
 
     # Assorted useful tidbits for subclasses
 
+    def _submit_command(self, command_message, ui_to_command_queue):
+        log = logging.getLogger('hooke')
+        log.debug('executing %s' % command_message)
+        ui_to_command_queue.put(command_message)
+
     def _splash_text(self, extra_info, **kwargs):
         return ("""
 Hooke version %s