[Spambayes-checkins] spambayes/windows pop3proxy_tray.py, 1.24, 1.25
Mark Hammond
mhammond at users.sourceforge.net
Thu Aug 24 14:45:46 CEST 2006
Update of /cvsroot/spambayes/spambayes/windows
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24833/windows
Modified Files:
pop3proxy_tray.py
Log Message:
re-add the taskbar icon in the case of explorer crashing and restarting
Index: pop3proxy_tray.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/windows/pop3proxy_tray.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** pop3proxy_tray.py 29 Mar 2005 05:59:25 -0000 1.24
--- pop3proxy_tray.py 24 Aug 2006 12:45:42 -0000 1.25
***************
*** 144,148 ****
--- 144,150 ----
1099 : ("Exit SpamBayes", self.OnExit),
}
+ msg_TaskbarRestart = RegisterWindowMessage("TaskbarCreated");
message_map = {
+ msg_TaskbarRestart: self.OnTaskbarRestart,
win32con.WM_DESTROY: self.OnDestroy,
win32con.WM_COMMAND: self.OnCommand,
***************
*** 188,195 ****
16, 16, icon_flags)
! flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
! nid = (self.hwnd, 0, flags, WM_TASKBAR_NOTIFY, self.hstartedicon,
! "SpamBayes")
! Shell_NotifyIcon(NIM_ADD, nid)
self.started = IsServerRunningAnywhere()
self.tip = None
--- 190,194 ----
16, 16, icon_flags)
! self._AddTaskbarIcon()
self.started = IsServerRunningAnywhere()
self.tip = None
***************
*** 205,208 ****
--- 204,221 ----
"a local server"
+ def _AddTaskbarIcon(self):
+ flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
+ nid = (self.hwnd, 0, flags, WM_TASKBAR_NOTIFY, self.hstartedicon,
+ "SpamBayes")
+ try:
+ Shell_NotifyIcon(NIM_ADD, nid)
+ except win32api_error:
+ # Apparently can be seen as XP is starting up. Certainly can
+ # be seen if explorer.exe is not running when started.
+ print "Ignoring error adding taskbar icon - explorer may not " \
+ "be running (yet)."
+ # The TaskbarRestart message will fire in this case, and
+ # everything will work out :)
+
def BuildToolTip(self):
tip = None
***************
*** 394,397 ****
--- 407,415 ----
function()
+ def OnTaskbarRestart(self, hwnd, msg, wparam, lparam):
+ # Called as the taskbar is created (either as Windows starts, or
+ # as Windows recovers from a crashed explorer.exe)
+ self._AddTaskbarIcon()
+
def OnExit(self):
if self.started and not self.use_service:
More information about the Spambayes-checkins
mailing list