mirror of
https://github.com/ciromattia/kcc
synced 2026-05-12 10:35:54 +00:00
Merge branch 'new-gui' of github.com:ciromattia/kcc into new-gui
This commit is contained in:
@@ -30,7 +30,7 @@ import urllib2
|
||||
import comic2ebook
|
||||
import kindlestrip
|
||||
from image import ProfileData
|
||||
from subprocess import call, STDOUT, PIPE
|
||||
from subprocess import call, Popen, STDOUT, PIPE
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from xml.dom.minidom import parse
|
||||
|
||||
@@ -73,7 +73,7 @@ class VersionThread(QtCore.QThread):
|
||||
except Exception:
|
||||
return
|
||||
latestVersion = XML.childNodes[0].getElementsByTagName('latest')[0].childNodes[0].toxml()
|
||||
if latestVersion != __version__:
|
||||
if tuple(map(int, (latestVersion.split(".")))) > tuple(map(int, (__version__.split(".")))):
|
||||
self.emit(QtCore.SIGNAL("addMessage"), 'New version is available!', 'warning')
|
||||
|
||||
|
||||
@@ -415,8 +415,22 @@ class Ui_KCC(object):
|
||||
self.addMessage('Welcome!', 'info')
|
||||
self.addMessage('Remember: All options have additional informations in tooltips.', 'info')
|
||||
if call('kindlegen', stdout=PIPE, stderr=STDOUT, shell=True) == 0:
|
||||
self.KindleGen = True
|
||||
formats = ['MOBI', 'EPUB', 'CBZ']
|
||||
versionCheck = Popen('kindlegen', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||
for line in versionCheck.stdout:
|
||||
if "Amazon kindlegen" in line:
|
||||
versionCheck = line.split('V')[1].split(' ')[0]
|
||||
if tuple(map(int, (versionCheck.split(".")))) >= tuple(map(int, ('2.9'.split(".")))):
|
||||
versionCheck = True
|
||||
else:
|
||||
versionCheck = False
|
||||
break
|
||||
if versionCheck:
|
||||
self.KindleGen = True
|
||||
formats = ['MOBI', 'EPUB', 'CBZ']
|
||||
else:
|
||||
self.KindleGen = False
|
||||
formats = ['EPUB', 'CBZ']
|
||||
self.addMessage('KindleGen is outdated! Creating MOBI files is disabled.', 'warning')
|
||||
else:
|
||||
self.KindleGen = False
|
||||
formats = ['EPUB', 'CBZ']
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: Śr 19. cze 10:35:51 2013
|
||||
# Created: Pt 21. cze 18:23:49 2013
|
||||
# by: The Resource Compiler for PyQt (Qt v4.8.4)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'KCC.ui'
|
||||
#
|
||||
# Created: Wed Jun 19 11:39:49 2013
|
||||
# Created: Fri Jun 21 18:23:19 2013
|
||||
# by: PyQt4 UI code generator 4.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'KCC-OSX.ui'
|
||||
#
|
||||
# Created: Wed Jun 19 13:56:35 2013
|
||||
# Created: Fri Jun 21 18:23:35 2013
|
||||
# by: PyQt4 UI code generator 4.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@@ -193,7 +193,6 @@ def buildNCX(dstdir, title, chapters):
|
||||
|
||||
def buildOPF(dstdir, title, filelist, cover=None):
|
||||
opffile = os.path.join(dstdir, 'OEBPS', 'content.opf')
|
||||
# read the first file resolution
|
||||
profilelabel, deviceres, palette, gamma, panelviewsize = options.profileData
|
||||
imgres = str(deviceres[0]) + "x" + str(deviceres[1])
|
||||
if options.righttoleft:
|
||||
@@ -337,7 +336,7 @@ def applyImgOptimization(img, isSplit, toRight, options, overrideQuality=5):
|
||||
img.resizeImage(options.upscale, options.stretch, options.black_borders, isSplit, toRight,
|
||||
options.landscapemode, options.quality)
|
||||
img.optimizeImage(options.gamma)
|
||||
if options.forcepng:
|
||||
if options.forcepng and not options.forcecolor:
|
||||
img.quantizeImage()
|
||||
|
||||
|
||||
@@ -627,10 +626,8 @@ def getWorkFolder(afile):
|
||||
|
||||
|
||||
def slugify(value):
|
||||
"""
|
||||
Normalizes string, converts to lowercase, removes non-alpha characters,
|
||||
and converts spaces to hyphens.
|
||||
"""
|
||||
# Normalizes string, converts to lowercase, removes non-alpha characters,
|
||||
# and converts spaces to hyphens.
|
||||
import unicodedata
|
||||
value = unicodedata.normalize('NFKD', unicode(value, 'latin1')).encode('ascii', 'ignore')
|
||||
value = re.sub('[^\w\s\.-]', '', value).strip().lower()
|
||||
@@ -794,7 +791,7 @@ def checkOptions():
|
||||
options.panelview = True
|
||||
options.landscapemode = False
|
||||
else:
|
||||
# Virtual Panel View
|
||||
# Virtual Panel View or Panel View disabled
|
||||
options.panelview = False
|
||||
# Older Kindle don't need higher resolution files due lack of Panel View.
|
||||
# Kindle Fire family have very high resolution. Bigger images are not needed.
|
||||
@@ -802,10 +799,8 @@ def checkOptions():
|
||||
or options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8':
|
||||
options.quality = 0
|
||||
# Disabling grayscale conversion for Kindle Fire family.
|
||||
# Forcing JPEG output. For now code can't provide color PNG files.
|
||||
if options.profile == 'KF' or options.profile == 'KFHD' or options.profile == 'KFHD8' or options.forcecolor:
|
||||
options.forcecolor = True
|
||||
options.forcepng = False
|
||||
else:
|
||||
options.forcecolor = False
|
||||
# Mixing vertical and horizontal pages require real Panel View.
|
||||
|
||||
@@ -28,14 +28,6 @@ except ImportError:
|
||||
exit(1)
|
||||
|
||||
|
||||
class ImageFlags:
|
||||
Orient = 1 << 0
|
||||
Resize = 1 << 1
|
||||
Frame = 1 << 2
|
||||
Quantize = 1 << 3
|
||||
Stretch = 1 << 4
|
||||
|
||||
|
||||
class ProfileData:
|
||||
Palette4 = [
|
||||
0x00, 0x00, 0x00,
|
||||
@@ -181,6 +173,7 @@ class ComicPage:
|
||||
size = (self.size[0], self.size[1])
|
||||
else:
|
||||
size = (self.panelviewsize[0], self.panelviewsize[1])
|
||||
# Kindle Paperwhite/Touch - Force upscale of splited pages to increase readability
|
||||
if isSplit and landscapeMode:
|
||||
upscale = True
|
||||
if self.image.size[0] <= self.size[0] and self.image.size[1] <= self.size[1]:
|
||||
|
||||
Reference in New Issue
Block a user