[Spambayes-checkins] spambayes/Outlook2000/dialogs/resources __init__.py, 1.2, 1.3

Mark Hammond mhammond at users.sourceforge.net
Fri Sep 5 00:53:26 EDT 2003


Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs/resources
In directory sc8-pr-cvs1:/tmp/cvs-serv30906

Modified Files:
	__init__.py 
Log Message:
Add GetImageParamsFromBitmapID() to centralize bitmap location logic,
hopefully taking into account a py2exe future.


Index: __init__.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/resources/__init__.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** __init__.py	10 Aug 2003 07:26:50 -0000	1.2
--- __init__.py	5 Sep 2003 06:53:24 -0000	1.3
***************
*** 1 ****
! # Empty file to designate this directory as a module.
--- 1,22 ----
! # Package that manages and defines dialog resources
! 
! def GetImageParamsFromBitmapID(rc_parser, bmpid):
!     import os, sys
!     import win32gui, win32con, win32api
!     if type(bmpid)==type(0):
!         bmpid = rc_parser.names[bmpid]
!     # For both binary and source versions, we currently load from files.
!     # In future py2exe built binary versions we will be able to load the
!     # bitmaps directly from our DLL.
!     filename = rc_parser.bitmaps[bmpid]
!     if hasattr(sys, "frozen"):
!         # bitmap in the app/images directory
!         # dont have manager available :(
!         dll_filename = win32api.GetModuleFileName(sys.frozendllhandle)
!         app_dir = os.path.dirname(dll_filename)
!         filename = os.path.join(app_dir, "images", filename)
!     else:
!         if not os.path.isabs(filename):
!             # In this directory
!             filename = os.path.join( os.path.dirname( __file__ ), filename)
!     return 0, filename, win32con.LR_LOADFROMFILE





More information about the Spambayes-checkins mailing list