From 50748782be38e6f02d86d558f2f5edb5e54dace6 2009-09-01 15:59:10 From: Fernando Perez Date: 2009-09-01 15:59:10 Subject: [PATCH] Adding longer polling time to wx inputhook to preserve battery life. --- diff --git a/IPython/lib/inputhookwx.py b/IPython/lib/inputhookwx.py index c908303..89e2857 100644 --- a/IPython/lib/inputhookwx.py +++ b/IPython/lib/inputhookwx.py @@ -147,10 +147,16 @@ def inputhook_wx3(): # 0.005 3% # 0.01 1.5% # 0.05 0.5% - if clock()-t > 1.0: + used_time = clock() - t + if used_time > 5*60.0: + # print 'Sleep for 5 s' # dbg + time.sleep(5.0) + elif used_time > 10.0: + # print 'Sleep for 1 s' # dbg time.sleep(1.0) - if clock()-t > 0.1: + elif used_time > 0.1: # Few GUI events coming in, so we can sleep longer + # print 'Sleep for 0.05 s' # dbg time.sleep(0.05) else: # Many GUI events coming in, so sleep only very little @@ -159,4 +165,4 @@ def inputhook_wx3(): return 0 # This is our default implementation -inputhook_wx = inputhook_wx3 \ No newline at end of file +inputhook_wx = inputhook_wx3