Update of /cvsroot/freevo/kaa/base/src/notifier
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29905

Modified Files:
        __init__.py callback.py 
Log Message:
Fix bug in Signal.disconnect; add keypress signal for handling keys on
stdin using utils.getch.  Once we add an event subsystem to kaa, this
would get moved there.


Index: __init__.py
===================================================================
RCS file: /cvsroot/freevo/kaa/base/src/notifier/__init__.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** __init__.py 13 Jul 2005 20:21:02 -0000      1.11
--- __init__.py 14 Jul 2005 00:11:52 -0000      1.12
***************
*** 43,46 ****
--- 43,47 ----
                       WeakOneShotTimer, SocketDispatcher, 
WeakSocketDispatcher,\
                       Signal
+ from kaa.base import utils
  
  # get logging object
***************
*** 50,53 ****
--- 51,58 ----
  running = False
  
+ def _handle_stdin_keypress(fd):
+     signals["keypress"].emit( utils.getch() )
+     return True
+ 
  
  def _idle_signal_changed(signal, flag):
***************
*** 58,64 ****
  
  
  signals = {
      "shutdown": Signal(),
!     "idle": Signal(changed_cb = _idle_signal_changed)
  }
  
--- 63,80 ----
  
  
+ def _keypress_signal_changed(signal, flag):
+     if flag == Signal.SIGNAL_CONNECTED and signal.count() == 1:
+         utils.getch_enable()
+         notifier.addSocket(sys.stdin, _handle_stdin_keypress)
+     elif flag == Signal.SIGNAL_DISCONNECTED and signal.count() == 0:
+         utils.getch_disable()
+         notifier.removeSocket(sys.stdin)
+ 
+ 
  signals = {
      "shutdown": Signal(),
!     "idle": Signal(changed_cb = _idle_signal_changed),
!     # Temporary until I find a bette rplace.
!     "keypress": Signal(changed_cb = _keypress_signal_changed)
  }
  

Index: callback.py
===================================================================
RCS file: /cvsroot/freevo/kaa/base/src/notifier/callback.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** callback.py 13 Jul 2005 23:39:43 -0000      1.5
--- callback.py 14 Jul 2005 00:11:52 -0000      1.6
***************
*** 408,412 ****
  
      def disconnect(self, callback, *args, **kwargs):
!         return self._disconnect(callback, False, args, kwargs)
  
  
--- 408,412 ----
  
      def disconnect(self, callback, *args, **kwargs):
!         return self._disconnect(callback, args, kwargs)
  
  



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP, 
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to