mirror of
https://github.com/ciromattia/kcc
synced 2026-10-11 20:12:33 +00:00
Indent with PEP-8 standard
This commit is contained in:
+28
-28
@@ -165,34 +165,34 @@ class ComicPage:
|
|||||||
#print "Image is %d x %d" % (width,height)
|
#print "Image is %d x %d" % (width,height)
|
||||||
# only split if origin is not oriented the same as target
|
# only split if origin is not oriented the same as target
|
||||||
if (width > height) != (dstwidth > dstheight):
|
if (width > height) != (dstwidth > dstheight):
|
||||||
if rotate:
|
if rotate:
|
||||||
self.image = self.image.rotate(90)
|
self.image = self.image.rotate(90)
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
if width > height:
|
if width > height:
|
||||||
# source is landscape, so split by the width
|
# source is landscape, so split by the width
|
||||||
leftbox = (0, 0, width / 2, height)
|
leftbox = (0, 0, width / 2, height)
|
||||||
rightbox = (width / 2, 0, width, height)
|
rightbox = (width / 2, 0, width, height)
|
||||||
else:
|
else:
|
||||||
# source is portrait and target is landscape, so split by the height
|
# source is portrait and target is landscape, so split by the height
|
||||||
leftbox = (0, 0, width, height / 2)
|
leftbox = (0, 0, width, height / 2)
|
||||||
rightbox = (0, height / 2, width, height)
|
rightbox = (0, height / 2, width, height)
|
||||||
filename = os.path.splitext(os.path.basename(self.origFileName))
|
filename = os.path.splitext(os.path.basename(self.origFileName))
|
||||||
fileone = targetdir + '/' + filename[0] + '-1' + filename[1]
|
fileone = targetdir + '/' + filename[0] + '-1' + filename[1]
|
||||||
filetwo = targetdir + '/' + filename[0] + '-2' + filename[1]
|
filetwo = targetdir + '/' + filename[0] + '-2' + filename[1]
|
||||||
try:
|
try:
|
||||||
if righttoleft:
|
if righttoleft:
|
||||||
pageone = self.image.crop(rightbox)
|
pageone = self.image.crop(rightbox)
|
||||||
pagetwo = self.image.crop(leftbox)
|
pagetwo = self.image.crop(leftbox)
|
||||||
else:
|
else:
|
||||||
pageone = self.image.crop(leftbox)
|
pageone = self.image.crop(leftbox)
|
||||||
pagetwo = self.image.crop(rightbox)
|
pagetwo = self.image.crop(rightbox)
|
||||||
pageone.save(fileone)
|
pageone.save(fileone)
|
||||||
pagetwo.save(filetwo)
|
pagetwo.save(filetwo)
|
||||||
os.remove(self.origFileName)
|
os.remove(self.origFileName)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
raise RuntimeError('Cannot write image in directory %s: %s' % (targetdir, e))
|
raise RuntimeError('Cannot write image in directory %s: %s' % (targetdir, e))
|
||||||
return fileone, filetwo
|
return fileone, filetwo
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user