Check whether pil or convert exist

svn: r1548
This commit is contained in:
Alex Roitman
2003-05-20 17:55:52 +00:00
parent 697e5cb456
commit 85cf4b342f
3 changed files with 49 additions and 31 deletions

View File

@@ -47,7 +47,7 @@ import const
import ImageSelect
import RelImage
from QuestionDialog import QuestionDialog, ErrorDialog
from QuestionDialog import QuestionDialog, ErrorDialog, WarningDialog
#-------------------------------------------------------------------------
#
@@ -119,6 +119,12 @@ class MediaView:
self.update = update
self.list.connect('button-press-event',self.on_button_press_event)
self.selection.connect('changed',self.on_select_row)
if not (RelImage.is_pil() or RelImage.is_cnv() ):
WarningDialog(_("Thumbnails not available")
,_("There is no suitable tool to generate thumbnails for the images. "
"If you would like to enable this feature, "
"install Python Imaging Library (PIL), available at http://www.pythonware.com/products/pil/ "
"or ImageMagick, available http://www.imagemagick.org/"))
def goto(self,id):
self.selection.unselect_all()

View File

@@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
# Copyright (C) 2000-2003 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -178,3 +178,23 @@ def check_thumb(source,dest,size):
return 1
#-------------------------------------------------------------------------
#
# Test if there's PIL available
#
#-------------------------------------------------------------------------
def is_pil():
try:
from PIL import __name__ as pilname
return 1
except:
return 0
#-------------------------------------------------------------------------
#
# Test if there's convert available
#
#-------------------------------------------------------------------------
def is_cnv():
return not os.system('which convert>/dev/null')