r15008 by jghali - #8777 : commit fix for InfoBox script from gpittman if anyone is still interested by 1.3.3.x

scribus-commit scribus-commit at lists.scribus.net
Fri Apr 23 22:20:22 CEST 2010


Revision: 15008
Author: jghali
Date: 2010-04-23T20:16:57.929256Z
Commit message: #8777 : commit fix for InfoBox script from gpittman if anyone is still interested by 1.3.3.x

Changeset: 
M  /branches/Version133x/Scribus/scribus/plugins/scriptplugin/scripts/InfoBox.py

Diffs:
Index: scribus/plugins/scriptplugin/scripts/InfoBox.py
===================================================================
--- scribus/plugins/scriptplugin/scripts/InfoBox.py	(revision 15007)
+++ scribus/plugins/scriptplugin/scripts/InfoBox.py	(revision 15008)
@@ -21,21 +21,25 @@
 
 """
 (C) 2005 by Thomas R. Koll, <tomk32 at gmx.de>, http://verlag.tomk32.de
-(c) 2008 modifications, additional features by Gregory Pittman
 
+(c) 2008, 2010 modifications, additional features, and some repair
+    by Gregory Pittman
+
 A simple script for exact placement of a frame (infobox)
 over the current textbox, asking the user for the width
 of the infobox and in which column to place it.
-Some enhancements:
+
+Some enhancements:<br>
 * You can now create a text frame or an image frame, and also load
-an image.
-* More than one infobox can be added to a text frame
-* Height and Y-Pos of top of infobox can be specified
-* Works with any page unit - pts, mm, in, and picas
+an image.<br>
+* More than one infobox can be added to a text frame by repeatedly running
+  the script (ie, no name conflicts occur).<br>
+* Height and Y-Pos of top of infobox can be specified.<br>
+* Works with any page unit - pts, mm, in, and picas, cm, and even ciceros.<br>
 * Infobox has Text Flows Around Frame activated, also
-  Scale Image to Frame for images
+  Scale Image to Frame for images.
 
-USAGE
+USAGE<br>
 Select a textframe, start the script and have phun
 Default name for the infobox is 'infobox' + name_of_selected_frame,
 but this can be changed.
@@ -49,11 +53,6 @@
     print "Unable to import the 'scribus' module. This script will only run within"
     print "the Python interpreter embedded in Scribus. Try Script->Execute Script."
     sys.exit(1)
-try:
-    from PIL import Image
-except ImportError:
-    print "Unable to import the Python Imaging Library module."
-    sys.exit(1)
 
 def main(argv):
     unit = scribus.getUnit()
@@ -131,11 +130,9 @@
     else:
         if (frametype == 'imageL'):
 	    imageload = scribus.fileDialog('Load image','Images(*.jpg *.png *.tif *.JPG *.PNG *.jpeg *.JPEG *.TIF)',haspreview=1)
-            im = Image.open(imageload)
-            xsize, ysize = im.size
-	    new_height = float(ysize)/float(xsize)*new_width
 	    new_image = scribus.createImage(new_left, float(new_top), new_width, float(new_height),framename)
 	    scribus.loadImage(imageload, new_image)
+            scribus.messageBox('Please Note',"Your frame will be created once you click OK.\n\nUse the Context Menu to Adjust Frame to Image.\n\nIf your image does not fill the width completely,\nstretch the frame vertically first.",scribus.BUTTON_OK)
         else:
 	    new_image = scribus.createImage(new_left, float(new_top), new_width, float(new_height),framename)
         scribus.textFlowsAroundFrame(new_image, 1)




More information about the scribus-commit mailing list