Author: dmeyer
Date: Tue Mar 27 18:17:52 2007
New Revision: 9396

Modified:
   trunk/ui/src/event.py
   trunk/ui/src/input/plugins/interface.py

Log:
Add source member to Event to detect if the event was generated
by system or by user input. Other sources like external (mbus)
could be possible in the future.


Modified: trunk/ui/src/event.py
==============================================================================
--- trunk/ui/src/event.py       (original)
+++ trunk/ui/src/event.py       Tue Mar 27 18:17:52 2007
@@ -29,6 +29,7 @@
 #
 # -----------------------------------------------------------------------------
 
+import copy
 import kaa.notifier
 
 class Event(kaa.notifier.Event):
@@ -41,6 +42,7 @@
         self.handler = None
         if 'handler' in kwargs:
             self.handler = kwargs['handler']
+        self.source = 'system'
 
 
     def set_handler(self, handler):
@@ -58,6 +60,15 @@
         return int(self.name[-1])
 
 
+    def post(self, event_source='system', *args):
+        """
+        Post event into the queue.
+        """
+        event = copy.copy(self)
+        event.source = event_source
+        if args:
+            event._set_args(args)
+        kaa.notifier.Event.post(event)
 
 
 #

Modified: trunk/ui/src/input/plugins/interface.py
==============================================================================
--- trunk/ui/src/input/plugins/interface.py     (original)
+++ trunk/ui/src/input/plugins/interface.py     Tue Mar 27 18:17:52 2007
@@ -75,6 +75,6 @@
             if not self.eventmap[c].has_key(key):
                 continue
 
-            return self.eventmap[c][key].post()
+            return self.eventmap[c][key].post(event_source='user')
 
         log.warning('no event mapping for key %s in %s' % (key, 
input.get_mapping()))

-------------------------------------------------------------------------
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