1
0
mirror of https://github.com/ciromattia/kcc synced 2026-02-18 02:01:08 +00:00

GUI update

This commit is contained in:
Paweł Jastrzębski
2013-03-17 09:37:57 +01:00
parent 943431346d
commit f5b515ef79
3 changed files with 49 additions and 43 deletions

View File

@@ -294,7 +294,7 @@ def applyImgOptimization(img, isSplit=False):
if options.cutpagenumbers:
img.cutPageNumber()
img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, options.landscapemode,
options.panelviewhq)
options.nopanelviewhq)
img.optimizeImage(options.gamma)
if not options.notquantize:
img.quantizeImage()
@@ -551,8 +551,8 @@ def main(argv=None):
help="Comic title [Default=filename]")
parser.add_option("-m", "--manga-style", action="store_true", dest="righttoleft", default=False,
help="Manga style (Right-to-left reading and splitting) [Default=False]")
parser.add_option("--panelviewhq", action="store_true", dest="panelviewhq", default=False,
help="Enable high quality Panel View [Default=False]")
parser.add_option("--nopanelviewhq", action="store_true", dest="nopanelviewhq", default=False,
help="Disable high quality Panel View [Default=False]")
parser.add_option("--noprocessing", action="store_false", dest="imgproc", 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,
@@ -621,6 +621,8 @@ def checkOptions():
else:
#Virtual Panel View
options.panelview = False
if options.profile == 'K1' or options.profile == 'K2' or options.profile == 'KDX' or options.profile == 'KDXG':
options.nopanelviewhq = True
def getEpubPath():

View File

@@ -94,28 +94,30 @@ class MainWindow:
self.options = {
'Aepub_only': IntVar(None, 0),
'Bmangastyle': IntVar(None, 0),
'Cimage_preprocess': IntVar(None, 0),
'Dnotquantize': IntVar(None, 0),
'Eimage_gamma': DoubleVar(None, 0.0),
'Fimage_upscale': IntVar(None, 0),
'Gimage_stretch': IntVar(None, 0),
'Hblack_borders': IntVar(None, 0),
'Irotate': IntVar(None, 0),
'Jnosplitrotate': IntVar(None, 0),
'Kcut_page_numbers': IntVar(None, 0)
'Cnopanelviewhq': IntVar(None, 0),
'Dimage_preprocess': IntVar(None, 0),
'Enotquantize': IntVar(None, 0),
'Fimage_gamma': DoubleVar(None, 0.0),
'Gimage_upscale': IntVar(None, 0),
'Himage_stretch': IntVar(None, 0),
'Iblack_borders': IntVar(None, 0),
'Jrotate': IntVar(None, 0),
'Knosplitrotate': IntVar(None, 0),
'Lcut_page_numbers': IntVar(None, 0)
}
self.optionlabels = {
'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",
'Eimage_gamma': "Custom gamma correction",
'Fimage_upscale': "Allow image upscaling",
'Gimage_stretch': "Stretch images",
'Hblack_borders': "Use black borders"
'Cnopanelviewhq': "Disable high quality Panel View",
'Dimage_preprocess': "Disable image optimizations",
'Enotquantize': "Disable image quantization",
'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 = {}
for key in sorted(self.options):
@@ -160,27 +162,29 @@ class MainWindow:
return
profilekey = ProfileData.ProfileLabels[self.profile.get()]
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:
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")
if self.options['Gimage_stretch'].get() == 1:
if self.options['Himage_stretch'].get() == 1:
argv.append("--stretch")
if self.options['Hblack_borders'].get() == 1:
if self.options['Iblack_borders'].get() == 1:
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
left_files = len(self.filelist)
filenum = 0

View File

@@ -90,9 +90,9 @@ class ProfileData:
ProfileLabels = {
"Kindle 1": 'K1',
"Kindle 2": 'K2',
"Kindle Keyboard": 'K3',
"Kindle Non-Touch": 'K4NT',
"Kindle Touch": 'K4T',
"Kindle 3/Keyboard": 'K3',
"Kindle 4/Non-Touch": 'K4NT',
"Kindle 4/Touch": 'K4T',
"Kindle Paperwhite": 'KHD',
"Kindle DX": 'KDX',
"Kindle DXG": 'KDXG'
@@ -144,13 +144,13 @@ class ComicPage:
self.image = self.image.quantize(palette=palImg)
def resizeImage(self, upscale=False, stretch=False, black_borders=False, isSplit=False, landscapeMode=False,
panelViewHQ=False):
noPanelViewHQ=False):
method = Image.ANTIALIAS
if black_borders:
fill = 'black'
else:
fill = 'white'
if panelViewHQ:
if not noPanelViewHQ:
size = (self.panelviewsize[0], self.panelviewsize[1])
else:
size = (self.size[0], self.size[1])
@@ -164,7 +164,7 @@ class ComicPage:
borderh = (self.size[1] - self.image.size[1]) / 2
self.image = ImageOps.expand(self.image, border=(borderw, borderh), fill=fill)
else:
method = Image.NEAREST
method = Image.BILINEAR
if stretch:
self.image = self.image.resize(self.size, method)
return self.image