[Pycodeocr-main] SF.net SVN: pycodeocr:[28] PyCodeOCR.py
Status: Beta
Brought to you by:
drtrigon
|
From: <la...@us...> - 2010-11-09 07:44:29
|
Revision: 28
http://pycodeocr.svn.sourceforge.net/pycodeocr/?rev=28&view=rev
Author: laserb
Date: 2010-11-09 07:44:23 +0000 (Tue, 09 Nov 2010)
Log Message:
-----------
show bigger image on mouse over
Modified Paths:
--------------
PyCodeOCR.py
Modified: PyCodeOCR.py
===================================================================
--- PyCodeOCR.py 2010-10-25 18:39:31 UTC (rev 27)
+++ PyCodeOCR.py 2010-11-09 07:44:23 UTC (rev 28)
@@ -181,6 +181,9 @@
# connect eventbox to close image window
self.eventbox1.connect('button_press_event', self.on_eventbox2_button_press_event)
+ self.window1.connect('motion_notify_event', self.on_pointer_motion)
+ self.window3.connect('leave-notify-event', self.on_leave_window)
+ (self.new_width, self.new_height ) = (0,0)
# set tooltips
self.button1.set_tooltip_text("Restart PyCodeOCR to search for a SANE device.")
@@ -226,6 +229,17 @@
## signals / glade callbacks
#
+ def on_leave_window(self, source=None, event=None):
+ if self.window3.get_visible():
+ self.on_eventbox2_button_press_event()
+
+ def on_pointer_motion(self, source=None, event=None):
+ (x,y,state) = self.window1.window.get_pointer()
+ (wxim, wyim ) = self.image1.get_size_request()
+ if x > 16+(wxim-self.new_width)/2 and x < 16+(wxim+self.new_width)/2 and y > 75+(wyim-self.new_height)/2 and y < 75+(wyim+self.new_height)/2:
+ if not self.window3.get_visible():
+ self.on_eventbox2_button_press_event()
+
def on_eventbox2_button_press_event(self, source=None, event=None):
if self.window3.get_visible():
# clean-up
@@ -241,7 +255,6 @@
ratio = min(float(width)/im_width,float(height)/im_height) #calculate resizing ratio
new_width = int(im_width*ratio)
new_height = int(im_height*ratio)
- print self.image2.get_size_request()
# resize to fit popup window
im = im1.resize((new_width, new_height), Image.BILINEAR)
# save
@@ -678,13 +691,13 @@
(im_width, im_height) = im1.size #get image size
(width, height) = self.image1.get_size_request() #get needed size
ratio = min(float(width)/im_width,float(height)/im_height) #calculate resizing ratio
- new_width = int(im_width*ratio)
- new_height = int(im_height*ratio)
+ self.new_width = int(im_width*ratio)
+ self.new_height = int(im_height*ratio)
# use one of these filter options to resize the image
#im = im1.resize((new_width, new_height), Image.NEAREST) # use nearest neighbour
- im = im1.resize((new_width, new_height), Image.BILINEAR) # linear interpolation in a 2x2 environment
+ im = im1.resize((self.new_width, self.new_height), Image.BILINEAR) # linear interpolation in a 2x2 environment
#im = im1.resize((new_width, new_height), Image.BICUBIC) # cubic spline interpolation in a 4x4 environment
#im = im1.resize((new_width, new_height), Image.ANTIALIAS) # best down-sizing filter
#ext = ".jpg"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|