mirror of
https://github.com/ciromattia/kcc
synced 2026-09-01 08:27:06 +00:00
GUI update
This commit is contained in:
+5
-3
@@ -294,7 +294,7 @@ def applyImgOptimization(img, isSplit=False):
|
|||||||
if options.cutpagenumbers:
|
if options.cutpagenumbers:
|
||||||
img.cutPageNumber()
|
img.cutPageNumber()
|
||||||
img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, options.landscapemode,
|
img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, options.landscapemode,
|
||||||
options.panelviewhq)
|
options.nopanelviewhq)
|
||||||
img.optimizeImage(options.gamma)
|
img.optimizeImage(options.gamma)
|
||||||
if not options.notquantize:
|
if not options.notquantize:
|
||||||
img.quantizeImage()
|
img.quantizeImage()
|
||||||
@@ -551,8 +551,8 @@ def main(argv=None):
|
|||||||
help="Comic title [Default=filename]")
|
help="Comic title [Default=filename]")
|
||||||
parser.add_option("-m", "--manga-style", action="store_true", dest="righttoleft", default=False,
|
parser.add_option("-m", "--manga-style", action="store_true", dest="righttoleft", default=False,
|
||||||
help="Manga style (Right-to-left reading and splitting) [Default=False]")
|
help="Manga style (Right-to-left reading and splitting) [Default=False]")
|
||||||
parser.add_option("--panelviewhq", action="store_true", dest="panelviewhq", default=False,
|
parser.add_option("--nopanelviewhq", action="store_true", dest="nopanelviewhq", default=False,
|
||||||
help="Enable high quality Panel View [Default=False]")
|
help="Disable high quality Panel View [Default=False]")
|
||||||
parser.add_option("--noprocessing", action="store_false", dest="imgproc", default=True,
|
parser.add_option("--noprocessing", action="store_false", dest="imgproc", default=True,
|
||||||
help="Do not apply image preprocessing (Page splitting and optimizations) [Default=True]")
|
help="Do not apply image preprocessing (Page splitting and optimizations) [Default=True]")
|
||||||
parser.add_option("--nodithering", action="store_true", dest="notquantize", default=False,
|
parser.add_option("--nodithering", action="store_true", dest="notquantize", default=False,
|
||||||
@@ -621,6 +621,8 @@ def checkOptions():
|
|||||||
else:
|
else:
|
||||||
#Virtual Panel View
|
#Virtual Panel View
|
||||||
options.panelview = False
|
options.panelview = False
|
||||||
|
if options.profile == 'K1' or options.profile == 'K2' or options.profile == 'KDX' or options.profile == 'KDXG':
|
||||||
|
options.nopanelviewhq = True
|
||||||
|
|
||||||
|
|
||||||
def getEpubPath():
|
def getEpubPath():
|
||||||
|
|||||||
+38
-34
@@ -94,28 +94,30 @@ class MainWindow:
|
|||||||
self.options = {
|
self.options = {
|
||||||
'Aepub_only': IntVar(None, 0),
|
'Aepub_only': IntVar(None, 0),
|
||||||
'Bmangastyle': IntVar(None, 0),
|
'Bmangastyle': IntVar(None, 0),
|
||||||
'Cimage_preprocess': IntVar(None, 0),
|
'Cnopanelviewhq': IntVar(None, 0),
|
||||||
'Dnotquantize': IntVar(None, 0),
|
'Dimage_preprocess': IntVar(None, 0),
|
||||||
'Eimage_gamma': DoubleVar(None, 0.0),
|
'Enotquantize': IntVar(None, 0),
|
||||||
'Fimage_upscale': IntVar(None, 0),
|
'Fimage_gamma': DoubleVar(None, 0.0),
|
||||||
'Gimage_stretch': IntVar(None, 0),
|
'Gimage_upscale': IntVar(None, 0),
|
||||||
'Hblack_borders': IntVar(None, 0),
|
'Himage_stretch': IntVar(None, 0),
|
||||||
'Irotate': IntVar(None, 0),
|
'Iblack_borders': IntVar(None, 0),
|
||||||
'Jnosplitrotate': IntVar(None, 0),
|
'Jrotate': IntVar(None, 0),
|
||||||
'Kcut_page_numbers': IntVar(None, 0)
|
'Knosplitrotate': IntVar(None, 0),
|
||||||
|
'Lcut_page_numbers': IntVar(None, 0)
|
||||||
}
|
}
|
||||||
self.optionlabels = {
|
self.optionlabels = {
|
||||||
'Aepub_only': "Generate EPUB only",
|
'Aepub_only': "Generate EPUB only",
|
||||||
'Cimage_preprocess': "Disable image optimizations",
|
|
||||||
'Dnotquantize': "Disable image quantization",
|
|
||||||
'Jnosplitrotate': "Disable splitting and rotation",
|
|
||||||
'Irotate': "Rotate images instead splitting them",
|
|
||||||
'Kcut_page_numbers': "Disable page numbers cutting",
|
|
||||||
'Bmangastyle': "Manga mode",
|
'Bmangastyle': "Manga mode",
|
||||||
'Eimage_gamma': "Custom gamma correction",
|
'Cnopanelviewhq': "Disable high quality Panel View",
|
||||||
'Fimage_upscale': "Allow image upscaling",
|
'Dimage_preprocess': "Disable image optimizations",
|
||||||
'Gimage_stretch': "Stretch images",
|
'Enotquantize': "Disable image quantization",
|
||||||
'Hblack_borders': "Use black borders"
|
'Fimage_gamma': "Custom gamma correction",
|
||||||
|
'Gimage_upscale': "Allow image upscaling",
|
||||||
|
'Himage_stretch': "Stretch images",
|
||||||
|
'Iblack_borders': "Use black borders",
|
||||||
|
'Jrotate': "Rotate images instead splitting them",
|
||||||
|
'Knosplitrotate': "Disable splitting and rotation",
|
||||||
|
'Lcut_page_numbers': "Disable page numbers cutting"
|
||||||
}
|
}
|
||||||
self.optionsButtons = {}
|
self.optionsButtons = {}
|
||||||
for key in sorted(self.options):
|
for key in sorted(self.options):
|
||||||
@@ -160,27 +162,29 @@ class MainWindow:
|
|||||||
return
|
return
|
||||||
profilekey = ProfileData.ProfileLabels[self.profile.get()]
|
profilekey = ProfileData.ProfileLabels[self.profile.get()]
|
||||||
argv = ["-p", profilekey]
|
argv = ["-p", profilekey]
|
||||||
if self.options['Eimage_gamma'].get() != 0.0:
|
|
||||||
argv.append("--gamma")
|
|
||||||
argv.append(self.options['Eimage_gamma'].get())
|
|
||||||
if self.options['Cimage_preprocess'].get() == 1:
|
|
||||||
argv.append("--noprocessing")
|
|
||||||
if self.options['Dnotquantize'].get() == 1:
|
|
||||||
argv.append("--nodithering")
|
|
||||||
if self.options['Jnosplitrotate'].get() == 1:
|
|
||||||
argv.append("--nosplitrotate")
|
|
||||||
if self.options['Irotate'].get() == 1:
|
|
||||||
argv.append("--rotate")
|
|
||||||
if self.options['Kcut_page_numbers'].get() == 1:
|
|
||||||
argv.append("--nocutpagenumbers")
|
|
||||||
if self.options['Bmangastyle'].get() == 1:
|
if self.options['Bmangastyle'].get() == 1:
|
||||||
argv.append("-m")
|
argv.append("-m")
|
||||||
if self.options['Fimage_upscale'].get() == 1:
|
if self.options['Cnopanelviewhq'].get() == 1:
|
||||||
|
argv.append("--nopanelviewhq")
|
||||||
|
if self.options['Dimage_preprocess'].get() == 1:
|
||||||
|
argv.append("--noprocessing")
|
||||||
|
if self.options['Enotquantize'].get() == 1:
|
||||||
|
argv.append("--nodithering")
|
||||||
|
if self.options['Fimage_gamma'].get() != 0.0:
|
||||||
|
argv.append("--gamma")
|
||||||
|
argv.append(self.options['Fimage_gamma'].get())
|
||||||
|
if self.options['Gimage_upscale'].get() == 1:
|
||||||
argv.append("--upscale")
|
argv.append("--upscale")
|
||||||
if self.options['Gimage_stretch'].get() == 1:
|
if self.options['Himage_stretch'].get() == 1:
|
||||||
argv.append("--stretch")
|
argv.append("--stretch")
|
||||||
if self.options['Hblack_borders'].get() == 1:
|
if self.options['Iblack_borders'].get() == 1:
|
||||||
argv.append("--blackborders")
|
argv.append("--blackborders")
|
||||||
|
if self.options['Jrotate'].get() == 1:
|
||||||
|
argv.append("--rotate")
|
||||||
|
if self.options['Knosplitrotate'].get() == 1:
|
||||||
|
argv.append("--nosplitrotate")
|
||||||
|
if self.options['Lcut_page_numbers'].get() == 1:
|
||||||
|
argv.append("--nocutpagenumbers")
|
||||||
errors = False
|
errors = False
|
||||||
left_files = len(self.filelist)
|
left_files = len(self.filelist)
|
||||||
filenum = 0
|
filenum = 0
|
||||||
|
|||||||
+6
-6
@@ -90,9 +90,9 @@ class ProfileData:
|
|||||||
ProfileLabels = {
|
ProfileLabels = {
|
||||||
"Kindle 1": 'K1',
|
"Kindle 1": 'K1',
|
||||||
"Kindle 2": 'K2',
|
"Kindle 2": 'K2',
|
||||||
"Kindle Keyboard": 'K3',
|
"Kindle 3/Keyboard": 'K3',
|
||||||
"Kindle Non-Touch": 'K4NT',
|
"Kindle 4/Non-Touch": 'K4NT',
|
||||||
"Kindle Touch": 'K4T',
|
"Kindle 4/Touch": 'K4T',
|
||||||
"Kindle Paperwhite": 'KHD',
|
"Kindle Paperwhite": 'KHD',
|
||||||
"Kindle DX": 'KDX',
|
"Kindle DX": 'KDX',
|
||||||
"Kindle DXG": 'KDXG'
|
"Kindle DXG": 'KDXG'
|
||||||
@@ -144,13 +144,13 @@ class ComicPage:
|
|||||||
self.image = self.image.quantize(palette=palImg)
|
self.image = self.image.quantize(palette=palImg)
|
||||||
|
|
||||||
def resizeImage(self, upscale=False, stretch=False, black_borders=False, isSplit=False, landscapeMode=False,
|
def resizeImage(self, upscale=False, stretch=False, black_borders=False, isSplit=False, landscapeMode=False,
|
||||||
panelViewHQ=False):
|
noPanelViewHQ=False):
|
||||||
method = Image.ANTIALIAS
|
method = Image.ANTIALIAS
|
||||||
if black_borders:
|
if black_borders:
|
||||||
fill = 'black'
|
fill = 'black'
|
||||||
else:
|
else:
|
||||||
fill = 'white'
|
fill = 'white'
|
||||||
if panelViewHQ:
|
if not noPanelViewHQ:
|
||||||
size = (self.panelviewsize[0], self.panelviewsize[1])
|
size = (self.panelviewsize[0], self.panelviewsize[1])
|
||||||
else:
|
else:
|
||||||
size = (self.size[0], self.size[1])
|
size = (self.size[0], self.size[1])
|
||||||
@@ -164,7 +164,7 @@ class ComicPage:
|
|||||||
borderh = (self.size[1] - self.image.size[1]) / 2
|
borderh = (self.size[1] - self.image.size[1]) / 2
|
||||||
self.image = ImageOps.expand(self.image, border=(borderw, borderh), fill=fill)
|
self.image = ImageOps.expand(self.image, border=(borderw, borderh), fill=fill)
|
||||||
else:
|
else:
|
||||||
method = Image.NEAREST
|
method = Image.BILINEAR
|
||||||
if stretch:
|
if stretch:
|
||||||
self.image = self.image.resize(self.size, method)
|
self.image = self.image.resize(self.size, method)
|
||||||
return self.image
|
return self.image
|
||||||
|
|||||||
Reference in New Issue
Block a user