[Spambayes-checkins] spambayes/Outlook2000/dialogs processors.py,
1.10, 1.11
Adam Walker
xenogeist at users.sourceforge.net
Tue Aug 26 22:09:30 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000/dialogs
In directory sc8-pr-cvs1:/tmp/cvs-serv3988/Outlook2000/dialogs
Modified Files:
processors.py
Log Message:
Cache bitmap handles.
Index: processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/processors.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** processors.py 27 Aug 2003 02:11:38 -0000 1.10
--- processors.py 27 Aug 2003 04:09:28 -0000 1.11
***************
*** 10,13 ****
--- 10,16 ----
from dlgutils import *
+ # Cache our leaky bitmap handles
+ bitmap_handles = {}
+
# A generic set of "ControlProcessors". A control processor by itself only
# does a few basic things.
***************
*** 52,66 ****
text = win32gui.GetWindowText(self.GetControl())
name = rcp.names[int(text)]
! filename = rcp.bitmaps[name]
! import os, sys
! if hasattr(sys, "frozen"):
! # bitmap in the app/images directory
! filename = os.path.join(self.window.manager.application_directory,
! "images", filename)
else:
! if not os.path.isabs(filename):
! filename = os.path.join( os.path.dirname( __file__ ), "resources", filename)
! handle = win32gui.LoadImage(0, filename, win32con.IMAGE_BITMAP,0,0,
! win32con.LR_COLOR|win32con.LR_LOADFROMFILE|win32con.LR_SHARED)
win32gui.SendMessage(self.GetControl(), win32con.STM_SETIMAGE, win32con.IMAGE_BITMAP, handle)
--- 55,73 ----
text = win32gui.GetWindowText(self.GetControl())
name = rcp.names[int(text)]
! if bitmap_handles.has_key(name):
! handle = bitmap_handles[name]
else:
! filename = rcp.bitmaps[name]
! import os, sys
! if hasattr(sys, "frozen"):
! # bitmap in the app/images directory
! filename = os.path.join(self.window.manager.application_directory,
! "images", filename)
! else:
! if not os.path.isabs(filename):
! filename = os.path.join( os.path.dirname( __file__ ), "resources", filename)
! handle = win32gui.LoadImage(0, filename, win32con.IMAGE_BITMAP,0,0,
! win32con.LR_COLOR|win32con.LR_LOADFROMFILE|win32con.LR_SHARED)
! bitmap_handles[name] = handle
win32gui.SendMessage(self.GetControl(), win32con.STM_SETIMAGE, win32con.IMAGE_BITMAP, handle)
More information about the Spambayes-checkins
mailing list