[Spambayes-checkins] spambayes/Outlook2000/dialogs FolderSelector.py, 1.26, 1.27 processors.py, 1.11, 1.12

Mark Hammond mhammond at users.sourceforge.net
Fri Sep 5 00:54:25 EDT 2003


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

Modified Files:
	FolderSelector.py processors.py 
Log Message:
Centralize bitmap locating code (the folder selector didn't work in the
binary build)


Index: FolderSelector.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/FolderSelector.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** FolderSelector.py	27 Aug 2003 06:53:27 -0000	1.26
--- FolderSelector.py	5 Sep 2003 06:54:23 -0000	1.27
***************
*** 426,437 ****
              win32gui.SendMessage(child, win32con.BM_SETCHECK, self.checkbox_state)
          self.list = self.GetDlgItem("IDC_LIST_FOLDERS")
! 
!         fname = os.path.join(os.path.dirname(__file__), "resources/folders.bmp")
          bitmapMask = win32api.RGB(0,0,255)
!         self.imageList = win32gui.ImageList_LoadImage(0, fname,
                                                          16, 0,
                                                          bitmapMask,
                                                          win32con.IMAGE_BITMAP,
!                                                         win32con.LR_LOADFROMFILE)
          win32gui.SendMessage( self.list,
                                  commctrl.TVM_SETIMAGELIST,
--- 426,438 ----
              win32gui.SendMessage(child, win32con.BM_SETCHECK, self.checkbox_state)
          self.list = self.GetDlgItem("IDC_LIST_FOLDERS")
!         import resources
!         mod_handle, mod_bmp, extra_flags = \
!              resources.GetImageParamsFromBitmapID(self.dialog_parser, "IDB_FOLDERS")
          bitmapMask = win32api.RGB(0,0,255)
!         self.imageList = win32gui.ImageList_LoadImage(mod_handle, mod_bmp,
                                                          16, 0,
                                                          bitmapMask,
                                                          win32con.IMAGE_BITMAP,
!                                                         extra_flags)
          win32gui.SendMessage( self.list,
                                  commctrl.TVM_SETIMAGELIST,
***************
*** 466,470 ****
              timer.kill_timer(self.timer_id)
          self.item_map = None
!         win32gui.ImageList_Destroy(self.imageList)
          FolderSelector_Parent.OnDestroy(self, hwnd, msg, wparam, lparam)
  
--- 467,472 ----
              timer.kill_timer(self.timer_id)
          self.item_map = None
!         if self.imageList:
!             win32gui.ImageList_Destroy(self.imageList)
          FolderSelector_Parent.OnDestroy(self, hwnd, msg, wparam, lparam)
  

Index: processors.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/dialogs/processors.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** processors.py	27 Aug 2003 04:09:28 -0000	1.11
--- processors.py	5 Sep 2003 06:54:23 -0000	1.12
***************
*** 53,73 ****
      def Init(self):
          rcp = self.window.manager.dialog_parser;
!         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)
  
--- 53,67 ----
      def Init(self):
          rcp = self.window.manager.dialog_parser;
!         bmp_id = int(win32gui.GetWindowText(self.GetControl()))
! 
!         if bitmap_handles.has_key(bmp_id):
!             handle = bitmap_handles[bmp_id]
          else:
!             import resources
!             mod_handle, mod_bmp, extra_flags = resources.GetImageParamsFromBitmapID(rcp, bmp_id)
!             load_flags = extra_flags|win32con.LR_COLOR|win32con.LR_SHARED
!             handle = win32gui.LoadImage(mod_handle, mod_bmp,
!                                         win32con.IMAGE_BITMAP,0,0,load_flags)
!             bitmap_handles[bmp_id] = handle
          win32gui.SendMessage(self.GetControl(), win32con.STM_SETIMAGE, win32con.IMAGE_BITMAP, handle)
  





More information about the Spambayes-checkins mailing list