[ocrfeeder] Fixes error when importing PDFs with spaces in their names (gc#12)
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] Fixes error when importing PDFs with spaces in their names (gc#12)
- Date: Fri, 5 Mar 2010 18:07:56 +0000 (UTC)
commit 9cb7758a6f8b1fea7d779a05fd76f6fcccf51d4f
Author: Joaquim Rocha <jrocha igalia com>
Date: Fri Mar 5 18:45:06 2010 +0100
Fixes error when importing PDFs with spaces in their names (gc#12)
studio/studioBuilder.py | 2 ++
util/lib.py | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/studio/studioBuilder.py b/studio/studioBuilder.py
index dda89fb..1d4b54a 100644
--- a/studio/studioBuilder.py
+++ b/studio/studioBuilder.py
@@ -153,6 +153,8 @@ class Studio:
delete_dialog.destroy()
def __addImagesToReviewer(self, images):
+ if not images:
+ return
for image in images:
pixbuf, image, iter = self.source_images_selector.addImage(image)
self.source_images_controler.addImage(pixbuf, image)
diff --git a/util/lib.py b/util/lib.py
index 63b76f9..22f8759 100644
--- a/util/lib.py
+++ b/util/lib.py
@@ -45,8 +45,12 @@ def convertPdfToImages(pdf_file, temp_dir = '/tmp'):
os.mkdir(dir_name)
except:
pass
- command = 'gs -SDEVICE=jpeg -r600x600 -sPAPERSIZE=letter -sOutputFile=%(temp_name)s/%(file_name)s_%%04d.jpg -dNOPAUSE -dBATCH -- %(pdf_file)s' % {'temp_dir': temp_dir, 'temp_name': dir_name,
- 'file_name': os.path.basename(dir_name), 'pdf_file': pdf_file}
+ command = 'gs -SDEVICE=jpeg -r600x600 -sPAPERSIZE=letter ' \
+ '-sOutputFile="%(temp_name)s/%(file_name)s_%%04d.jpg" ' \
+ '-dNOPAUSE -dBATCH -- "%(pdf_file)s"' % \
+ {'temp_name': dir_name,
+ 'file_name': os.path.basename(pdf_file),
+ 'pdf_file': pdf_file}
os.popen(command)
return dir_name
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]