Author: dmeyer
Date: Tue Mar 27 18:18:31 2007
New Revision: 9397

Modified:
   trunk/core/src/xmlconfig.py
   trunk/ui/src/config.py

Log:
make it possible to define events in cxml files

Modified: trunk/core/src/xmlconfig.py
==============================================================================
--- trunk/core/src/xmlconfig.py (original)
+++ trunk/core/src/xmlconfig.py Tue Mar 27 18:18:31 2007
@@ -142,6 +142,16 @@
     find_plugins(doc.firstChild)
     out.write(']\n')
 
+    def find_events(node):
+        for child in node.childNodes:
+            if child.nodeName == 'event':
+                out.write('\'%s\', ' % child.getAttribute('name'))
+            if child.nodeName == 'group':
+                find_events(child)
+    out.write('\nevents = [')
+    find_events(doc.firstChild)
+    out.write(']\n')
+    
     def find_code(node):
         for child in node.childNodes:
             if child.nodeName == 'code':

Modified: trunk/ui/src/config.py
==============================================================================
--- trunk/ui/src/config.py      (original)
+++ trunk/ui/src/config.py      Tue Mar 27 18:18:31 2007
@@ -43,6 +43,9 @@
 from freevo.xmlconfig import xmlconfig
 from freevo import plugin
 
+# freevo.ui imports
+import event as eventmodule
+
 # generate config
 pycfgfile = freevo.conf.datafile('freevo_config.py')
 cfgdir = os.path.join(freevo.conf.SHAREDIR, 'config')
@@ -55,6 +58,11 @@
 # add external stuff
 config.add_variable('player', kaa.popcorn.config)
 
+# add events defined in xml config to event.py. 'events' is defined in the
+# freevo_config.py file.
+for e in events:
+    setattr(eventmodule, e, eventmodule.Event(e))
+
 # load config
 cfgfile = os.path.expanduser('~/.freevo/freevo2.conf')
 if '-c' in sys.argv:
@@ -81,7 +89,7 @@
     # or kaa.base.
     logging.getLogger().setLevel(logging.INFO)
 
-# plugins ist a list of known plugins
+# plugins is a list of known plugins
 for p in plugins:
     c = config
     for attr in p.split('.'):

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to