Author: dmeyer
Date: Sat Apr 14 18:05:43 2007
New Revision: 9437
Removed:
trunk/ui/src/configfile.py
Modified:
trunk/ui/bin/freevo
trunk/ui/src/__init__.py
trunk/ui/src/config.cxml
Log:
move configfile code to __init__ and bin/freevo
Modified: trunk/ui/bin/freevo
==============================================================================
--- trunk/ui/bin/freevo (original)
+++ trunk/ui/bin/freevo Sat Apr 14 18:05:43 2007
@@ -86,15 +86,55 @@
from xml.utils import qp_xml
from xml.dom import minidom
except ImportError:
- raise ImportError('No module named pyxml')
+ pass
# now load other modules to check if all requirements are installed
import pysqlite2
- # import ui path (ugly)
import freevo
+ import freevo.plugin
+ import freevo.ui
- from freevo.ui import config
+ config = freevo.ui.config
+
+ # load config file
+ cfgfile = os.path.expanduser('~/.freevo/freevo2.conf')
+ if '-c' in sys.argv:
+ cfgfile = sys.argv[sys.argv.index('-c')+1]
+
+ if not os.path.isfile(cfgfile):
+ print '%s does not exist' % cfgfile
+ print 'The file is now created and Freevo will stop so you can'
+ print 'adjust the config settings.'
+ print 'You should recheck freevo2.conf after every svn update. Use'
+ print '\'freevo setup\' to rebuild the file without starting freevo.'
+ print 'Your settings will be saved when the config file is rewritten.'
+ config.load(cfgfile, create=True)
+ sys.exit(0)
+
+ config.load(cfgfile, create=True)
+ if len(sys.argv) > 1 and sys.argv[1] in ('setup', '--setup', 'config',
'--config'):
+ print 'wrote %s' % cfgfile
+ sys.exit(0)
+
+ if config.debug:
+ # FIXME: make it possible to set debug for specific parts.
+ # Maybe use an environment variable and hock it into freevo.core
+ # or kaa.base.
+ logging.getLogger().setLevel(logging.INFO)
+
+ # plugins is a list of known plugins
+ for p in freevo.ui.plugins:
+ c = config
+ for attr in p.split('.'):
+ c = getattr(c, attr)
+ if c.activate:
+ p = p.replace('plugin.', '').replace('..', '.')
+ if isinstance(c.activate, bool):
+ freevo.plugin.activate(p)
+ else:
+ freevo.plugin.activate(p, level=c.activate)
+
if config.gui.display.engine.lower() == 'sdl':
import pygame
@@ -157,7 +197,7 @@
os.execvp('xinit', [ 'xinit', sys.argv[0], '-force-fs', '--',
':'+str(server_num) ])
# freevo imports
-from freevo import plugin, beacon
+from freevo import beacon
from freevo.ui.gui import theme, widgets, animation, displays, areas
# load the fxditem to make sure it's the first in the
@@ -253,11 +293,11 @@
displays.create()
# Fire up splashscreen and load the plugins
- num = len(plugin.get(None))-1
+ num = len(freevo.plugin.get(None))-1
splash = Splashscreen(_('Starting Freevo, please wait ...'), num)
# load plugins
- plugin.init(freevo.ui, splash.progress)
+ freevo.plugin.init(freevo.ui, splash.progress)
# fade out the splash screen
splash.hide()
Modified: trunk/ui/src/__init__.py
==============================================================================
--- trunk/ui/src/__init__.py (original)
+++ trunk/ui/src/__init__.py Sat Apr 14 18:05:43 2007
@@ -1 +1,53 @@
-from configfile import config
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------------
+# freevo.ui
+# -----------------------------------------------------------------------------
+# $Id$
+#
+# -----------------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2007 Dirk Meyer, et al.
+#
+# First Edition: Dirk Meyer <[EMAIL PROTECTED]>
+# Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
+#
+# Please see the file AUTHORS for a complete list of authors.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# -----------------------------------------------------------------------------
+
+# python imports
+import os
+
+# freevo core imports
+import freevo.conf
+import freevo.xmlconfig
+
+# freevo.ui imports
+import event
+
+# generate config
+pycfgfile = freevo.conf.datafile('freevo_config.py')
+cfgdir = os.path.join(freevo.conf.SHAREDIR, 'config')
+cfgsource = [ os.path.join(cfgdir, f) for f in os.listdir(cfgdir) ]
+freevo.xmlconfig.xmlconfig(pycfgfile, cfgsource)
+
+# load config structure. This will add 'config', 'plugins' and 'events'
+execfile(pycfgfile)
+
+# add events defined in xml config to event.py.
+for e in events:
+ setattr(event, e, event.Event(e))
Modified: trunk/ui/src/config.cxml
==============================================================================
--- trunk/ui/src/config.cxml (original)
+++ trunk/ui/src/config.cxml Sat Apr 14 18:05:43 2007
@@ -95,4 +95,6 @@
</var>
</group>
+ <extern name="player" module="kaa.popcorn"/>
+
</config>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog