diff options
author | gpittman <gpittman@11d20701-8431-0410-a711-e3c959e3b870> | 2012-06-28 23:57:30 +0000 |
---|---|---|
committer | gpittman <gpittman@11d20701-8431-0410-a711-e3c959e3b870> | 2012-06-28 23:57:30 +0000 |
commit | 12cc8c2da8460a2f4a3b9c39da2c9fa6048402b2 (patch) | |
tree | cded1ff2b6f10b1c3a39db6ea96119170b2a2d70 | |
parent | 2bafb6b5a4bc40b30925b9df284bcc8e51a447fa (diff) | |
download | scribus-12cc8c2da8460a2f4a3b9c39da2c9fa6048402b2.tar.gz scribus-12cc8c2da8460a2f4a3b9c39da2c9fa6048402b2.tar.xz scribus-12cc8c2da8460a2f4a3b9c39da2c9fa6048402b2.zip |
InfoBox.py won't fail now if you don't have PIL, ie works on Windows as before
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17648 11d20701-8431-0410-a711-e3c959e3b870
-rw-r--r-- | scribus/plugins/scriptplugin/scripts/InfoBox.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/scribus/plugins/scriptplugin/scripts/InfoBox.py b/scribus/plugins/scriptplugin/scripts/InfoBox.py index 1353cc9..6204773 100644 --- a/scribus/plugins/scriptplugin/scripts/InfoBox.py +++ b/scribus/plugins/scriptplugin/scripts/InfoBox.py @@ -61,11 +61,13 @@ except ImportError: 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) + +pil_found = 1 + try: from PIL import Image except ImportError: - print "Unable to import the Python Imaging Library module." - sys.exit(1) + pil_found = 0 def main(argv): unit = scribus.getUnit() @@ -124,7 +126,7 @@ def main(argv): while (new_height == 0): new_height = scribus.valueDialog('Height','Your frame height is '+ str(o_height) + unitlabel +'. How tall\n do you want your ' + - 'infobox to be in '+ unitlabel +'?\n If you load an image, height will be\n calculated, so the value here does not\n matter.', str(o_height)) + 'infobox to be in '+ unitlabel +'?\n If you load an image and have the PIL module, height will be\n calculated, so the value here will not\n matter in that case.', str(o_height)) new_top = -1 while (new_top < 0): new_top = scribus.valueDialog('Y-Pos','The top of your infobox is currently\n'+ str(top) + @@ -143,10 +145,13 @@ def main(argv): 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) + if (pil_found == 1): + im = Image.open(imageload) + xsize, ysize = im.size + new_height = float(ysize)/float(xsize)*new_width + else: + 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) + new_image = scribus.createImage(new_left, float(new_top), new_width, float(new_height),framename) scribus.loadImage(imageload, new_image) else: new_image = scribus.createImage(new_left, float(new_top), new_width, float(new_height),framename) |