Changeset 59 for pykoticon

Show
Ignore:
Timestamp:
01/15/05 12:09:44 (19 years ago)
Author:
jerome
Message:

Added the timer functionnality

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykoticon/trunk/bin/pykoticon

    r58 r59  
    182182        self.menu.Append(self.TBMENU_RESTORE, "Show Print Quota") 
    183183        self.menu.Append(self.TBMENU_CLOSE, "Quit") 
    184  
    185     def OnIconify(self, evt): 
     184         
     185        self.TBTIMER = wx.NewId() 
     186        self.chrono = wx.wxTimer(self, self.TBTIMER) 
     187        EVT_TIMER(self, self.TBTIMER, self.OnChronoTimer) 
     188         
     189        self.User = None 
     190        self.networkInterface = CGINetworkInterface(DUMPYKOTA_URL) 
     191        self.inTimer = 0 
     192        self.chrono.Start(1000 * 60 * 3) # every 3 minutes 
     193 
     194    def getCurrentUserName(self) : 
     195        """Returns the name of the current user.""" 
     196        return win32api.GetUserName() 
     197         
     198    def OnChronoTimer(self, event) : 
     199        """Retrieves user's data quota information.""" 
     200        if not self.inTimer : # avoids re-entrance 
     201            self.inTimer = 1 
     202            self.User = self.networkInterface.getUser(self.getCurrentUserName()) 
     203            self.inTimer = 0 
     204     
     205    def OnIconify(self, event) : 
    186206        self.Hide() 
    187207 
    188     def OnTaskBarActivate(self, event): 
    189         if self.IsIconized(): 
     208    def OnTaskBarActivate(self, event) : 
     209        if self.IsIconized() : 
    190210            self.Iconize(False) 
    191         if not self.IsShown(): 
     211        if not self.IsShown() : 
    192212            self.Show(True) 
    193213        self.Raise() 
    194214 
    195     def OnCloseWindow(self, event): 
     215    def OnCloseWindow(self, event) : 
     216        if hasattr(self, "chrono") : 
     217            self.chrono.Stop() 
     218            del self.chrono 
    196219        if hasattr(self, "menu") : 
    197220            menu.Destroy() 
    198221            del self.menu 
    199         if hasattr(self, "tbicon"): 
     222        if hasattr(self, "tbicon") : 
    200223            self.tbicon.Destroy() 
    201224            del self.tbicon 
    202225        self.Destroy() 
    203226 
    204     def OnTaskBarMenu(self, evt): 
     227    def OnTaskBarMenu(self, evt) : 
    205228        self.tbicon.PopupMenu(self.menu) 
    206229 
    207     def OnTaskBarClose(self, evt): 
     230    def OnTaskBarClose(self, evt) : 
    208231        self.Close() 
    209232        wxPython.wx.wxGetApp().ProcessIdle()