[Spambayes-checkins] spambayes/Outlook2000 addin.py,1.111,1.112
Mark Hammond
mhammond at users.sourceforge.net
Mon Sep 15 02:26:38 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv321
Modified Files:
addin.py
Log Message:
Support for py2exe - add a "DllRegisterServer" method, and load button
bitmaps from the DLL rather than the source .bmp in binary builds.
Index: addin.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/addin.py,v
retrieving revision 1.111
retrieving revision 1.112
diff -C2 -d -r1.111 -r1.112
*** addin.py 14 Sep 2003 20:24:12 -0000 1.111
--- addin.py 15 Sep 2003 06:26:35 -0000 1.112
***************
*** 1,4 ****
# SpamBayes Outlook Addin
-
import sys, os
import warnings
--- 1,3 ----
***************
*** 721,732 ****
# Also note that the clipboard takes ownership of the handle -
# thus, 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,)
! return None
! handle = win32gui.LoadImage(0, fname, win32con.IMAGE_BITMAP, 0, 0, win32con.LR_DEFAULTSIZE | win32con.LR_LOADFROMFILE)
win32clipboard.OpenClipboard()
win32clipboard.SetClipboardData(win32con.CF_BITMAP, handle)
--- 720,741 ----
# Also note that the clipboard takes ownership of the handle -
# thus, we can not simply perform this load once and reuse the image.
! # Hacks for the binary - we can get the bitmaps from resources.
! if hasattr(sys, "frozen"):
! if fname=="recover_ham.bmp":
! bid = 6000
! elif fname=="delete_as_spam.bmp":
! bid = 6001
! else:
! raise RuntimeError, "What bitmap to use for '%s'?" % fname
! handle = win32gui.LoadImage(sys.frozendllhandle, bid, win32con.IMAGE_BITMAP, 0, 0, win32con.LR_DEFAULTSIZE)
! else:
! 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,)
! return None
! handle = win32gui.LoadImage(0, fname, win32con.IMAGE_BITMAP, 0, 0, win32con.LR_DEFAULTSIZE | win32con.LR_LOADFROMFILE)
win32clipboard.OpenClipboard()
win32clipboard.SetClipboardData(win32con.CF_BITMAP, handle)
***************
*** 1407,1415 ****
pass
if __name__ == '__main__':
import win32com.server.register
win32com.server.register.UseCommandLine(OutlookAddin)
if "--unregister" in sys.argv:
! UnregisterAddin(OutlookAddin)
else:
! RegisterAddin(OutlookAddin)
--- 1416,1430 ----
pass
+ def DllRegisterServer():
+ RegisterAddin(OutlookAddin)
+
+ def DllUnregisterServer():
+ UnregisterAddin(OutlookAddin)
+
if __name__ == '__main__':
import win32com.server.register
win32com.server.register.UseCommandLine(OutlookAddin)
if "--unregister" in sys.argv:
! DllUnregisterServer()
else:
! DllRegisterServer()
More information about the Spambayes-checkins
mailing list