Update of /cvsroot/freevo/freevo/src/input
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12704/src/input

Modified Files:
        __init__.py interface.py 
Log Message:
move context handling from eventhandler to input

Index: interface.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/input/interface.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** interface.py        15 Jul 2005 20:44:05 -0000      1.3
--- interface.py        16 Jul 2005 08:41:12 -0000      1.4
***************
*** 30,33 ****
--- 30,36 ----
  # 
-----------------------------------------------------------------------------
  
+ __all__ = [ 'set_mapping', 'get_mapping', 'InputPlugin' ]
+ 
+ 
  # python imports
  import copy
***************
*** 37,44 ****
  import config
  import plugin
- import eventhandler
  
  # get logging object
! log = logging.getLogger('config')
  
  class InputPlugin(plugin.Plugin):
--- 40,64 ----
  import config
  import plugin
  
  # get logging object
! log = logging.getLogger('input')
! 
! # set key mapping for input
! _mapping = None
! 
! def set_mapping(mapping):
!     """
!     Set new key mapping.
!     """
!     global _mapping
!     _mapping = mapping
! 
! 
! def get_mapping():
!     """
!     Get current key mapping.
!     """
!     return _mapping
! 
  
  class InputPlugin(plugin.Plugin):
***************
*** 47,54 ****
      type should be in input/plugins
      """
-     def __init__(self):
-         plugin.Plugin.__init__(self)
-         self._eventhandler = eventhandler.get_singleton()
- 
  
      def post_key(self, key):
--- 67,70 ----
***************
*** 59,73 ****
              return None
  
!         for c in (self._eventhandler.context, 'global'):
!             try:
!                 e = copy.copy(config.EVENTS[c][key])
!                 e.context = self._eventhandler.context
!                 e.post()
!                 break
!             except KeyError:
!                 pass
!         else:
!             log.warning('no event mapping for key %s in context %s' % \
!                         (key, self._eventhandler.context))
  
  
--- 75,87 ----
              return None
  
!         for c in (_mapping, 'global'):
!             if not config.EVENTS.has_key(c):
!                 continue
!             if not config.EVENTS[c].has_key(key):
!                 continue
! 
!             return config.EVENTS[c][key].post()
! 
!         log.warning('no event mapping for key %s in %s' % (key, _mapping))
  
  
***************
*** 77,79 ****
          """
          self._eventhandler.post(event)
-         
--- 91,92 ----

Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/input/__init__.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** __init__.py 8 Jul 2005 19:01:57 -0000       1.5
--- __init__.py 16 Jul 2005 08:41:12 -0000      1.6
***************
*** 7,10 ****
--- 7,13 ----
      pass
  
+ 
  from keymap import KEYBOARD_MAP, REMOTE_MAP
  from eventmap import EVENTMAP
+ 
+ from interface import set_mapping, get_mapping, InputPlugin



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to