X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=hooke%2Fhooke.py;h=6e3dc754f3f522b550ec7f633fd85f048a3a6516;hb=8f7381a37aedac943bf8a25fbc6483ed9529b789;hp=98f364904f4fb0a7ef6cb5f68c0573a4da10e819;hpb=34fb609d190fd15a5d77b30439821a590ac9e364;p=hooke.git diff --git a/hooke/hooke.py b/hooke/hooke.py index 98f3649..6e3dc75 100644 --- a/hooke/hooke.py +++ b/hooke/hooke.py @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2010 Fabrizio Benedetti +# Copyright (C) 2008-2011 Fabrizio Benedetti # Massimo Sandal # Rolf Schmidt # W. Trevor King @@ -92,7 +92,7 @@ class Hooke (object): self.load_drivers() self.load_ui() self.engine = engine.CommandEngine() - self.playlists = playlist.NoteIndexList() + self.playlists = playlist.Playlists() def load_log(self): config_file = StringIO.StringIO() @@ -101,6 +101,8 @@ class Hooke (object): # Don't attach the logger because it contains an unpicklable # thread.lock. Instead, grab it directly every time you need it. #self.log = logging.getLogger('hooke') + log = logging.getLogger('hooke') + log.debug('config paths: %s' % self.config._config_paths) def load_plugins(self): self.plugins = plugin_mod.load_graph( @@ -227,6 +229,12 @@ def main(): p.add_option( '-p', '--persist', dest='persist', action='store_true', default=False, help="Don't exit after running a script or commands.") + p.add_option( + '-u', '--ui', dest='user_interface', + help="Override the configured user interface (for easy switching).") + p.add_option( + '--config', dest='config', metavar='FILE', + help="Override the default config file chain.") p.add_option( '--save-config', dest='save_config', action='store_true', default=False, @@ -240,6 +248,9 @@ def main(): % (sys.argv[0], arguments) p.print_help(sys.stderr) sys.exit(1) + if options.config != None: + config_mod.DEFAULT_PATHS = [ + os.path.abspath(os.path.expanduser(options.config))] hooke = Hooke(debug=__debug__) runner = HookeRunner() @@ -251,6 +262,12 @@ def main(): hooke.config.set( section='handler_hand1', option='level', value='NOTSET') hooke.load_log() + if options.user_interface not in [None, hooke.ui.name]: + hooke.config.set( + ui.USER_INTERFACE_SETTING_SECTION, hooke.ui.name, False) + hooke.config.set( + ui.USER_INTERFACE_SETTING_SECTION, options.user_interface, True) + hooke.load_ui() if options.script != None: with open(os.path.expanduser(options.script), 'r') as f: options.commands.extend(f.readlines())