runtime checks for pil and pyqt to allow for easy cli-only on some systems

git-svn-id: http://comictagger.googlecode.com/svn/trunk@91 6c5673fe-1810-88d6-992b-cd32ca31540c
This commit is contained in:
beville@gmail.com 2012-11-27 18:00:27 +00:00
parent e37612ffeb
commit e4f96fe4cb
3 changed files with 25 additions and 6 deletions

View File

@ -25,8 +25,11 @@ import urllib2, urllib
import math
import re
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
from PyQt4.QtCore import QUrl, pyqtSignal, QObject, QByteArray
try:
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest
from PyQt4.QtCore import QUrl, pyqtSignal, QObject, QByteArray
except ImportError:
pass
import utils
from settings import ComicTaggerSettings

View File

@ -1,7 +1,14 @@
import Image
import StringIO
try:
import Image
pil_available = True
except ImportError:
pil_available = False
class ImageHasher(object):
def __init__(self, path=None, data=None, width=8, height=8):
#self.hash_size = size

View File

@ -22,7 +22,11 @@ import sys
import math
import urllib2, urllib
import StringIO
import Image
try:
import Image
pil_available = True
except ImportError:
pil_available = False
from settings import ComicTaggerSettings
from comicvinecacher import ComicVineCacher
@ -203,10 +207,15 @@ class IssueIdentifier:
ca = self.comic_archive
self.match_list = []
self.cancel = False
self.search_result = self.ResultNoMatches
if not pil_available:
print "Python Imaging Library (PIL) is not available and is needed for issue identification."
return self.match_list
if not ca.seemsToBeAComicArchive():
self.log_msg( "Sorry, but "+ opts.filename + " is not a comic archive!")
return self.ResultNoMatches, []
return self.match_list
cover_image_data = ca.getCoverPage()
cover_hash = self.calculateHash( cover_image_data )