Merge branch 'master' into kcc-fakepanelview
Apply PEP-8 codestyle
This commit is contained in:
1 parent
67baf90d04
commit
19dc5cc6f2
2 files changed
+12
-12
No files matched your search
+10
-9
@@ -163,18 +163,15 @@ def buildOPF(profile, dstdir, title, filelist, cover=None, righttoleft=False):
|
||||
])
|
||||
if options.landscapemode:
|
||||
f.writelines(["<meta name=\"rendition:orientation\" content=\"auto\"/>\n",
|
||||
"<meta name=\"orientation-lock\" content=\"none\"/>\n"
|
||||
])
|
||||
"<meta name=\"orientation-lock\" content=\"none\"/>\n"])
|
||||
else:
|
||||
f.writelines(["<meta name=\"rendition:orientation\" content=\"portrait\"/>\n",
|
||||
"<meta name=\"orientation-lock\" content=\"portrait\"/>\n"
|
||||
])
|
||||
"<meta name=\"orientation-lock\" content=\"portrait\"/>\n"])
|
||||
f.writelines(["<meta name=\"original-resolution\" content=\"", imgres, "\"/>\n",
|
||||
"<meta name=\"primary-writing-mode\" content=\"", writingmode, "\"/>\n",
|
||||
"<meta name=\"rendition:layout\" content=\"pre-paginated\"/>\n",
|
||||
"</metadata>\n<manifest>\n<item id=\"ncx\" href=\"toc.ncx\" ",
|
||||
"media-type=\"application/x-dtbncx+xml\"/>\n"
|
||||
])
|
||||
"media-type=\"application/x-dtbncx+xml\"/>\n"])
|
||||
if cover is not None:
|
||||
filename = getImageFileName(cover.replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\'))
|
||||
if '.png' == filename[1]:
|
||||
@@ -207,7 +204,8 @@ def buildOPF(profile, dstdir, title, filelist, cover=None, righttoleft=False):
|
||||
splitCountUsed = 1
|
||||
for entry in reflist:
|
||||
if entry.endswith("-1"):
|
||||
if ((righttoleft and facing == 'left') or (not righttoleft and facing == 'right')) and options.landscapemode:
|
||||
if ((righttoleft and facing == 'left') or (not righttoleft and facing == 'right')) and\
|
||||
options.landscapemode:
|
||||
f.write("<itemref idref=\"blank-page" + str(splitCountUsed) + "\" properties=\"layout-blank\"/>\n")
|
||||
splitCountUsed += 1
|
||||
if options.landscapemode:
|
||||
@@ -317,8 +315,10 @@ def dirImgProcess(path):
|
||||
if options.fakepanelview or options.fakepanelviewlandscape:
|
||||
img0 = image.ComicPage(split[0], options.profile)
|
||||
img1 = image.ComicPage(split[1], options.profile)
|
||||
splitA = img0.splitPageFakePanelView(dirpath, options.righttoleft, options.fakepanelviewlandscape)
|
||||
splitB = img1.splitPageFakePanelView(dirpath, options.righttoleft, options.fakepanelviewlandscape)
|
||||
splitA = img0.splitPageFakePanelView(dirpath, options.righttoleft,
|
||||
options.fakepanelviewlandscape)
|
||||
splitB = img1.splitPageFakePanelView(dirpath, options.righttoleft,
|
||||
options.fakepanelviewlandscape)
|
||||
for img in splitA:
|
||||
tempImg = image.ComicPage(img, options.profile)
|
||||
applyImgOptimization(tempImg)
|
||||
@@ -522,6 +522,7 @@ def main(argv=None):
|
||||
rmtree(path)
|
||||
return epubpath
|
||||
|
||||
|
||||
def checkOptions():
|
||||
global options
|
||||
if options.profile == 'K4' or options.profile == 'KHD':
|
||||
|
||||
+2
-3
@@ -141,7 +141,8 @@ class ComicPage:
|
||||
palImg.putpalette(self.palette)
|
||||
self.image = self.image.quantize(palette=palImg)
|
||||
|
||||
def resizeImage(self, upscale=False, stretch=False, black_borders=False, fakePanelViewLandscape=False, isSplit=False, toRight=False, landscapeMode=False):
|
||||
def resizeImage(self, upscale=False, stretch=False, black_borders=False, fakePanelViewLandscape=False,
|
||||
isSplit=False, toRight=False, landscapeMode=False):
|
||||
method = Image.ANTIALIAS
|
||||
if black_borders:
|
||||
fill = 'black'
|
||||
@@ -222,7 +223,6 @@ class ComicPage:
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def splitPageFakePanelView(self, targetdir, righttoleft=False, fakePanelWiewLandscape=False):
|
||||
width, height = self.image.size
|
||||
if fakePanelWiewLandscape:
|
||||
@@ -274,7 +274,6 @@ class ComicPage:
|
||||
raise RuntimeError('Cannot write image in directory %s: %s' % (targetdir, e))
|
||||
return file0, file1, file2, file3, file4
|
||||
|
||||
|
||||
# def frameImage(self):
|
||||
# foreground = tuple(self.palette[:3])
|
||||
# background = tuple(self.palette[-3:])
|
||||
|
||||
Reference in new issue
Block a user