[Image-SIG] Patch to Grail/pil_interface.py

Fred L. Drake Fred L. Drake, Jr." <fdrake@acm.org
Thu, 4 Jun 1998 11:20:59 -0400 (EDT)


  The patch below should be applied to the file Grail/pil_interface.py 
in the PIL distribution.  This removes the bogus highlight border
around the label used to hold the image, makes some adjustments to the 
contents of the label before the image is ready, and removes the
timing printouts: I don't think anyone doubts that PIL is a lot
faster!


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives
1895 Preston White Dr.	    Reston, VA  20191


*** pil_interface.py.dist	Sun Dec  8 10:00:23 1996
--- pil_interface.py	Thu Jun  4 11:14:12 1998
***************
*** 6,16 ****
  #	pil_interface.py -- a PIL interface for Grail
  #
- # Notes:
- #	You may wish to remove the print statements in here.  They
- #	are included only to show you that PIL is pretty fast compared
- #	to everything else...
- #
  # History:
  #	96-04-18 fl	Created
  #
  
--- 6,13 ----
  #	pil_interface.py -- a PIL interface for Grail
  #
  # History:
  #	96-04-18 fl	Created
+ #	98-06-04 fld	Made minimal changes to look better with current
+ #			Grail implementation; removed timimg display.
  #
  
***************
*** 36,47 ****
  	self.viewer = viewer
  	self.viewer.new_font((AS_IS, AS_IS, AS_IS, 1))
! 	self.label = Tkinter.Label(self.viewer.text, text = "<decoding>")
  	self.viewer.add_subwindow(self.label)
  	self.buf = []
  
- 	global t
- 	t = time.time()
- 	print "** GRAIL", time.time() - t
- 
      def feed(self, data):
  	try:
--- 33,42 ----
  	self.viewer = viewer
  	self.viewer.new_font((AS_IS, AS_IS, AS_IS, 1))
! 	self.label = Tkinter.Label(self.viewer.text, text="<decoding>",
!                                    background=viewer.text.cget("background"),
!                                    highlightthickness=0)
  	self.viewer.add_subwindow(self.label)
  	self.buf = []
  
      def feed(self, data):
  	try:
***************
*** 57,61 ****
  	if self.buf:
  	    try:
- 		print "** PIL", time.time() - t
  		self.buf = string.joinfields(self.buf, "")
  		im = Image.open(StringIO.StringIO(self.buf))
--- 52,55 ----
***************
*** 64,70 ****
  		tkim.paste(im)
  		self.label.image = tkim.image
- 		print "** TK", time.time() - t
  		self.label.config(image = self.label.image)
- 		print "** OK", time.time() - t
  	    except:
  		self.broken = 1
--- 58,62 ----