[Spambayes-checkins] spambayes/windows pop3proxy_tray.py,1.3,1.4

Tony Meyer anadelonbrin at users.sourceforge.net
Mon Sep 1 18:15:14 EDT 2003


Update of /cvsroot/spambayes/spambayes/windows
In directory sc8-pr-cvs1:/tmp/cvs-serv383/windows

Modified Files:
	pop3proxy_tray.py 
Log Message:
Remove assumptions about which directory we are running in when finding the
icon, and get rid of the code to deal with not finding it.

Update the menu to reflect the current start/stop status.

Index: pop3proxy_tray.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/windows/pop3proxy_tray.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pop3proxy_tray.py	1 Sep 2003 21:56:20 -0000	1.3
--- pop3proxy_tray.py	2 Sep 2003 00:15:12 -0000	1.4
***************
*** 40,43 ****
--- 40,45 ----
  WM_TASKBAR_NOTIFY = win32con.WM_USER + 20
  
+ START_STOP_ID = 1024
+ 
  class MainWindow(object):
      def __init__(self):
***************
*** 46,50 ****
          # that the order is controlled by the id.  Any items were the
          # function is None will appear as separators.
!         self.control_functions = {1024 : ("Start SpamBayes", self.StartStop),
                                    1025 : ("-", None),
                                    1026 : ("View information ...", self.OpenInterface),
--- 48,52 ----
          # that the order is controlled by the id.  Any items were the
          # function is None will appear as separators.
!         self.control_functions = {START_STOP_ID : ("Stop SpamBayes", self.StartStop),
                                    1025 : ("-", None),
                                    1026 : ("View information ...", self.OpenInterface),
***************
*** 61,83 ****
          # Create the Window.
          hinst = GetModuleHandle(None)
!         # this will replaced with a real configure dialog later
!         # this is mainly to work around not being able to register a window class
!         # with python 2.3
!         dialogTemplate = [['SpamBayes', (14, 10, 246, 187), -1865809852 & ~win32con.WS_VISIBLE, None, (8, 'Tahoma')],]
!         self.hwnd = CreateDialogIndirect(hinst, dialogTemplate, 0, message_map)
  
!         # Try and find a custom icon
!         # XXX This needs to be done, but first someone needs to make a wee
!         # XXX spambayes icon
!         iconPathName = os.path.abspath( "resources\\sbicon.ico" )
!         if not os.path.isfile(iconPathName):
!             # Look in the source tree.
!             iconPathName = os.path.abspath(os.path.join( os.path.split(sys.executable)[0], "..\\PC\\pyc.ico" ))
          if os.path.isfile(iconPathName):
              icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
!             hicon = LoadImage(hinst, iconPathName, win32con.IMAGE_ICON, 0, 0, icon_flags)
!         else:
!             print "Can't find a spambayes icon file - using default"
!             hicon = LoadIcon(0, win32con.IDI_APPLICATION)
  
          flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
--- 63,85 ----
          # Create the Window.
          hinst = GetModuleHandle(None)
!         # This will replaced with a real configure dialog later
!         # This is mainly to work around not being able to register a window
!         # class with Python 2.3
!         dialogTemplate = [['SpamBayes', (14, 10, 246, 187),
!                            -1865809852 & ~win32con.WS_VISIBLE, None,
!                            (8, 'Tahoma')],]
!         self.hwnd = CreateDialogIndirect(hinst, dialogTemplate, 0,
!                                          message_map)
  
!         # Get the custom icon
!         iconPathName = "%s\\windows\\resources\\sbicon.ico" % \
!                        (os.path.dirname(pop3proxy.__file__),)
!         # When 1.0a6 is released, the above line will need to change to:
! ##        iconPathName = "%s\\..\\windows\\resources\\sbicon.ico" % \
! ##                       (os.path.dirname(pop3proxy.__file__),)
          if os.path.isfile(iconPathName):
              icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
!             hicon = LoadImage(hinst, iconPathName, win32con.IMAGE_ICON, 0,
!                               0, icon_flags)
  
          flags = NIF_ICON | NIF_MESSAGE | NIF_TIP
***************
*** 153,158 ****
--- 155,164 ----
              pop3proxy.stop(pop3proxy.state)
              self.started = False
+             self.control_functions[START_STOP_ID] = ("Start SpamBayes",
+                                                      self.StartStop)
          else:
              self.StartProxyThread()
+             self.control_functions[START_STOP_ID] = ("Stop SpamBayes",
+                                                      self.StartStop)
  
      def OpenInterface(self):





More information about the Spambayes-checkins mailing list