Re: [pygtk] Best way to check program idle time??

2005-11-11 Thread Steve McClure
On Fri, 2005-11-11 at 09:36 -0700, Chris Irish wrote:
 If I have a pygtk app and I want it to do something if its been sitting 
 idle for a few minutes.  What is the best way to go about this?  It 
 seems to me that I would need a timer that would be reset everytime a 
 signal was emitted or something?  Any ideas. or has anyone done 
 this.  Would I need every signal emitted to call a timer reset method 
 AND the method to perform its usual action?  How would i keep the timer 
 incrementing after I left the method? 

I created a base class that most of my dialogs inherit.  Then is has a
setup method that goes through every widget in the dialog and connects
to the key_press_event and button_press_event.  That event handler
updates my session timer. Then a timeout runs that checks that session
timer and does the appropriate stuff.

 
 Thanks,
 Chris
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure   Racemi
email: [EMAIL PROTECTED]  75 5th St NE
voice: 404-892-5850 Suite 333
fax: 404-892-7215   Atlanta, GA 30308
http://www.racemi.com

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Best way to check program idle time??

2005-11-11 Thread Chris Irish




Steve McClure wrote:

  On Fri, 2005-11-11 at 09:36 -0700, Chris Irish wrote:
  
  
If I have a pygtk app and I want it to do something if its been sitting 
idle for a few minutes.  What is the best way to go about this?  It 
seems to me that I would need a timer that would be reset everytime a 
signal was emitted or something?  Any ideas. or has anyone done 
this.  Would I need every signal emitted to call a timer reset method 
AND the method to perform its usual action?  How would i keep the timer 
incrementing after I left the method? 

  
  
I created a base class that most of my dialogs inherit.  Then is has a
setup method that goes through every widget in the dialog and connects
to the key_press_event and button_press_event.  That event handler
updates my session timer. Then a timeout runs that checks that session
timer and does the appropriate stuff.

  
  
Thanks,
Chris


  


How does your session timer get updated when there are no events
happening? Are you using the system clock or something?

Thanks for the info :)


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Best way to check program idle time??

2005-11-11 Thread Steve McClure
On Fri, 2005-11-11 at 10:26 -0700, Chris Irish wrote:
 Steve McClure wrote: 
  On Fri, 2005-11-11 at 09:36 -0700, Chris Irish wrote:

   If I have a pygtk app and I want it to do something if its been sitting 
   idle for a few minutes.  What is the best way to go about this?  It 
   seems to me that I would need a timer that would be reset everytime a 
   signal was emitted or something?  Any ideas. or has anyone done 
   this.  Would I need every signal emitted to call a timer reset method 
   AND the method to perform its usual action?  How would i keep the timer 
   incrementing after I left the method? 
   
  
  I created a base class that most of my dialogs inherit.  Then is has a
  setup method that goes through every widget in the dialog and connects
  to the key_press_event and button_press_event.  That event handler
  updates my session timer. Then a timeout runs that checks that session
  timer and does the appropriate stuff.
  

   Thanks,
   Chris
   
   
 
 How does your session timer get updated when there are no events
 happening?  Are you using the system clock or something?

It doesn't, that's how you know that something hasn't happened for a
while from the idle task that checks on the session timer.


 
 Thanks for the info :)
 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure   Racemi
email: [EMAIL PROTECTED]  75 5th St NE
voice: 404-892-5850 Suite 333
fax: 404-892-7215   Atlanta, GA 30308
http://www.racemi.com

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Best way to check program idle time??

2005-11-11 Thread Chris Irish




Steve McClure wrote:

  On Fri, 2005-11-11 at 10:26 -0700, Chris Irish wrote:
  
  
Steve McClure wrote: 


  On Fri, 2005-11-11 at 09:36 -0700, Chris Irish wrote:
  
  
  
If I have a pygtk app and I want it to do something if its been sitting 
idle for a few minutes.  What is the best way to go about this?  It 
seems to me that I would need a timer that would be reset everytime a 
signal was emitted or something?  Any ideas. or has anyone done 
this.  Would I need every signal emitted to call a timer reset method 
AND the method to perform its usual action?  How would i keep the timer 
incrementing after I left the method? 


  
  I created a base class that most of my dialogs inherit.  Then is has a
setup method that goes through every widget in the dialog and connects
to the key_press_event and button_press_event.  That event handler
updates my session timer. Then a timeout runs that checks that session
timer and does the appropriate stuff.

  
  
  
Thanks,
Chris



  

How does your session timer get updated when there are no events
happening?  Are you using the system clock or something?

  
  
It doesn't, that's how you know that something hasn't happened for a
while from the idle task that checks on the session timer.


  

Ahh well then i guess my question really is.how does the timeout
work? More specically, how do you have it set up so that it checks the
session time at a specified interval. Or is the timeout check run for
every emitted signal? Sorry for all the questions I just want to make
sure I'm understanding you right.


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Best way to check program idle time??

2005-11-11 Thread Steve McClure
On Fri, 2005-11-11 at 10:55 -0700, Chris Irish wrote:
 Steve McClure wrote: 
  On Fri, 2005-11-11 at 10:26 -0700, Chris Irish wrote:

   Steve McClure wrote: 
   
On Fri, 2005-11-11 at 09:36 -0700, Chris Irish wrote:
  
  
 If I have a pygtk app and I want it to do something if its been 
 sitting 
 idle for a few minutes.  What is the best way to go about this?  It 
 seems to me that I would need a timer that would be reset everytime a 
 signal was emitted or something?  Any ideas. or has anyone done 
 this.  Would I need every signal emitted to call a timer reset method 
 AND the method to perform its usual action?  How would i keep the 
 timer 
 incrementing after I left the method? 
 
 
I created a base class that most of my dialogs inherit.  Then is has a
setup method that goes through every widget in the dialog and connects
to the key_press_event and button_press_event.  That event handler
updates my session timer. Then a timeout runs that checks that session
timer and does the appropriate stuff.

  
  
 Thanks,
 Chris
 
 
 
   How does your session timer get updated when there are no events
   happening?  Are you using the system clock or something?
   
  
  It doesn't, that's how you know that something hasn't happened for a
  while from the idle task that checks on the session timer.
  
  

 Ahh  well then i guess my question really is.how does the timeout
 work?  More specically, how do you have it set up so that it checks
 the session time at a specified interval.  Or  is the timeout check
 run for every emitted signal?  Sorry for all the questions I just want
 to make sure I'm understanding you right.

No problem, I wasn't very clear.

I have a timeout handler that runs every minute.  It checks the session
updated timestamp against the current time.  If the difference is more
than the allowed idle session time (system configuration variable) then
I take an action.  In this case I force them to enter their password
again.

 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure   Racemi
email: [EMAIL PROTECTED]  75 5th St NE
voice: 404-892-5850 Suite 333
fax: 404-892-7215   Atlanta, GA 30308
http://www.racemi.com

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/