[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.43,1.44

Mark Hammond mhammond at users.sourceforge.net
Thu Jan 9 16:35:00 EST 2003


Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv5656

Modified Files:
	addin.py 
Log Message:
Fix a crash setting up the toolbar buttons in a second window.

Also some changes to use the "application_directory" to locate the images -
these are for a standalone DLL version of the addin, which is not yet ready
but on its way.


Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** addin.py	15 Dec 2002 14:05:35 -0000	1.43
--- addin.py	10 Jan 2003 00:34:57 -0000	1.44
***************
*** 294,298 ****
                          "Move the selected message to the Spam folder,\n" \
                          "and train the system that this is Spam."
!         SetButtonImage(self, image)
  
      def OnClick(self, button, cancel):
--- 294,298 ----
                          "Move the selected message to the Spam folder,\n" \
                          "and train the system that this is Spam."
!         SetButtonImage(self, image, manager)
  
      def OnClick(self, button, cancel):
***************
*** 332,336 ****
                  "folder is not known), and trains the system that\n" \
                  "this is a good message\n"
!         SetButtonImage(self, image)
  
      def OnClick(self, button, cancel):
--- 332,336 ----
                  "folder is not known), and trains the system that\n" \
                  "this is a good message\n"
!         SetButtonImage(self, image, manager)
  
      def OnClick(self, button, cancel):
***************
*** 361,365 ****
  
  # Helpers to work with images on buttons/toolbars.
! def SetButtonImage(button, fname):
      # whew - http://support.microsoft.com/default.aspx?scid=KB;EN-US;q288771
      # shows how to make a transparent bmp.
--- 361,365 ----
  
  # Helpers to work with images on buttons/toolbars.
! def SetButtonImage(button, fname, manager):
      # whew - http://support.microsoft.com/default.aspx?scid=KB;EN-US;q288771
      # shows how to make a transparent bmp.
***************
*** 367,377 ****
      # this, we can not simply perform this load once and reuse the image.
      if not os.path.isabs(fname):
!         if hasattr(sys, "frozen"):
!             # images relative to the executable.
!             fname = os.path.join(os.path.dirname(sys.argv[0]),
                                   "images", fname)
-         else:
-             # Ensure references are relative to this .py file
-             fname = os.path.join( os.path.dirname(__file__), "images", fname)
      if not os.path.isfile(fname):
          print "WARNING - Trying to use image '%s', but it doesn't exist" % (fname,)
--- 367,373 ----
      # this, we can not simply perform this load once and reuse the image.
      if not os.path.isabs(fname):
!         # images relative to the application path
!         fname = os.path.join(manager.application_directory,
                                   "images", fname)
      if not os.path.isfile(fname):
          print "WARNING - Trying to use image '%s', but it doesn't exist" % (fname,)
***************
*** 506,509 ****
--- 502,510 ----
      # The Outlook event handlers
      def OnActivate(self):
+         # See comments for OnNewExplorer below.
+         # *sigh* - OnActivate seems too early too :(
+         pass
+ 
+     def OnSelectionChange(self):
          # See comments for OnNewExplorer below.
          if not self.have_setup_ui:





More information about the Spambayes-checkins mailing list