Changeset 139

Show
Ignore:
Timestamp:
04/14/08 04:04:15 (6 months ago)
Author:
njriley
Message:

reset the idle timeout when you touch a button

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sucrose/trunk/python/keypad_tk.py

    r134 r139  
    1414class TkinterUI(user_interface.UserInterface): 
    1515        def update(self, tray): 
     16                self.reset_idle_timeout() 
    1617                for i in self.views: 
    1718                        if hasattr(i, 'update'): 
     
    6364                self.views.append(self.keypad) 
    6465 
    65                 # Kill yourself after 30 seconds 
    66                 self.window.after(30000,self.destroy) 
    6766                Tkinter.Button(self.window, text="Cancel", 
    6867                                           font=('helvetica', 24, 'bold'), command=self.destroy).\ 
     
    7069                self.window.mainloop() 
    7170 
     71 
     72        def reset_idle_timeout(self): 
     73                if hasattr(self, 'timeout_id'): 
     74                        self.window.after_cancel(self.timeout_id) 
     75                # Kill yourself after 30 seconds 
     76                self.timeout_id = self.window.after(30000, self.destroy) 
    7277 
    7378        def switch_view(self, view): 
     
    7782                self.view_buttons[view].config(relief=Tkinter.SUNKEN) 
    7883                view.grid(row=1, column=0) 
     84                self.reset_idle_timeout() 
    7985 
    8086