Ran update_copyright.py
[hooke.git] / hooke / plugin / config.py
index ff76d8f66321215742b157da1b91811a22c4778d..b0bcf3b50619f2cdf53207b3cd7c35f8dbf7100b 100644 (file)
@@ -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
@@ -31,9 +31,8 @@ from ..plugin import Builtin
 class ConfigPlugin (Builtin):
     def __init__(self):
         super(ConfigPlugin, self).__init__(name='config')
-
-    def commands(self):
-        return [GetCommand(), SetCommand(), PrintCommand()]
+        self._commands = [GetCommand(self), SetCommand(self),
+                          PrintCommand(self)]
 
 
 # Define common or complicated arguments
@@ -56,11 +55,11 @@ Configuration option to act on.
 class GetCommand (Command):
     """Get the current value of a configuration option.
     """
-    def __init__(self):
+    def __init__(self, plugin):
         super(GetCommand, self).__init__(
             name='get config',
             arguments=[SectionArgument, OptionArgument],
-            help=self.__doc__)
+            help=self.__doc__, plugin=plugin)
 
     def _run(self, hooke, inqueue, outqueue, params):
        outqueue.put(hooke.config.get(params['section'], params['option']))
@@ -74,7 +73,7 @@ class SetCommand (Command):
     noticed by the target classes unless the configuration is reloaded.
     This reloading may cause problems in poorly written UIs.
     """
-    def __init__(self):
+    def __init__(self, plugin):
         super(SetCommand, self).__init__(
             name='set config',
             arguments=[
@@ -83,22 +82,24 @@ class SetCommand (Command):
                     name='value', type='string', optional=False,
                     help='Value to set.'),
                 ],
-            help=self.__doc__)
+            help=self.__doc__, plugin=plugin)
 
     def _run(self, hooke, inqueue, outqueue, params):
        hooke.config.set(params['section'], params['option'], params['value'])
         # push config changes
+        hooke.load_log()
         hooke.load_plugins()
         hooke.load_drivers()
+        hooke.load_ui()  # for post-HookeRunner Hooke return.
         # notify UI to update config
         outqueue.put(ReloadUserInterfaceConfig(hooke.config))
 
 class PrintCommand (Command):
     """Get the current value of a configuration option.
     """
-    def __init__(self):
+    def __init__(self, plugin):
         super(PrintCommand, self).__init__(
-            name='print config', help=self.__doc__)
+            name='print config', help=self.__doc__, plugin=plugin)
 
     def _run(self, hooke, inqueue, outqueue, params):
         out = StringIO()