1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-29 01:21:56 +00:00

Merge branch 'new-gui' of github.com:ciromattia/kcc into new-gui

This commit is contained in:
Ciro Mattia Gonano
2013-06-24 10:56:46 +02:00
9 changed files with 60 additions and 43 deletions

View File

@@ -24,9 +24,8 @@ You can find the latest released binary at the following links:
- **OS X:** [http://kcc.vulturis.eu/OSX/](http://kcc.vulturis.eu/OSX/)
- **Linux:** Just download sourcecode and launch: `python kcc.py`
_It has been reported by a couple of users 2.10 crashing on OSX at start.
If it happens to you please append your message to [Issue #52](https://github.com/ciromattia/kcc/issues/52).
In the meanwhile you can download [version 2.9](http://kcc.vulturis.eu/OSX/KindleComicConverter_osx_2.9.zip)._
_It has been reported by a couple of users that version 2.10 crashing on OSX at start. We don't know if that issue still exist in version 3.0.
If it happens to you please append your message to [Issue #52](https://github.com/ciromattia/kcc/issues/52)._
## INPUT FORMATS
**KCC** can understand and convert, at the moment, the following file types:
@@ -37,7 +36,7 @@ In the meanwhile you can download [version 2.9](http://kcc.vulturis.eu/OSX/Kindl
- PDF *(Extracting only contained JPG images)*
## OPTIONAL REQUIREMENTS
- [KindleGen](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211) v2.8+ in a directory reachable by your _PATH_ or in _KCC_ directory *(For .mobi generation)*
- [KindleGen](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211) v2.9+ in a directory reachable by your _PATH_ or in _KCC_ directory *(For .mobi generation)*
- [UnRAR](http://www.rarlab.com/download.htm) *(For CBR/RAR support)*
### For compiling/running from source:
@@ -50,6 +49,8 @@ In the meanwhile you can download [version 2.9](http://kcc.vulturis.eu/OSX/Kindl
### Important tips:
* Use high quality source files. **This little detail have a major impact on the final result.**
* Read tooltip of _High/Ultra quality_ option. There are many important informations there.
* When converting images smaller than device resolution remember to enable upscaling.
* Check our [wiki](https://github.com/ciromattia/kcc/wiki/Other-devices) for a list of tested Non-Kindle E-Readers.
* The first image found will be set as the comic's cover.
* All files/directories will be added to EPUB in alphabetical order.
* Output MOBI file should be uploaded via USB. Other methods (e.g. via Calibre) might corrupt it.

View File

@@ -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']

View File

@@ -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!

View File

@@ -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!

View File

@@ -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!

View File

@@ -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.

View File

@@ -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]:

2
other/qt.conf Normal file
View File

@@ -0,0 +1,2 @@
[Paths]
Plugins = DumbHackThatFixPY2APP

View File

@@ -2,35 +2,46 @@
cx_Freeze build script for KCC.
Usage (Mac OS X):
python setup.py bdist_mac
python setup.py py2app
Usage (Windows):
python setup.py build
"""
from sys import platform
from cx_Freeze import setup, Executable
NAME = "KindleComicConverter"
VERSION = "3.0"
MAIN = "kcc.py"
includefiles = ['LICENSE.txt']
includes = []
excludes = []
if platform == "darwin":
from setuptools import setup
extra_options = dict(
options={"build_exe": {"include_files": includefiles, "excludes": excludes, "compressed": True},
"bdist_mac": {"iconfile": "icons/comic2ebook.icns"}},
executables=[Executable(MAIN,
copyDependentFiles=True,
appendScriptToExe=True,
appendScriptToLibrary=False,
compress=True)])
setup_requires=['py2app'],
app=[MAIN],
options=dict(
py2app=dict(
argv_emulation=True,
iconfile='icons/comic2ebook.icns',
includes=['PIL', 'sip', 'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui'],
resources=['other/qt.conf', 'LICENSE.txt'],
plist=dict(
CFBundleName=NAME,
CFBundleShortVersionString=VERSION,
CFBundleGetInfoString=NAME + " " + VERSION +
", written 2012-2013 by Ciro Mattia Gonano and Pawel Jastrzebski",
CFBundleExecutable=NAME,
CFBundleIdentifier='com.github.ciromattia.kcc',
CFBundleSignature='dplt',
NSHumanReadableCopyright='ISC License (ISCL)'
)
)
)
)
elif platform == "win32":
from cx_Freeze import setup, Executable
base = "Win32GUI"
extra_options = dict(
options={"build_exe": {"include_files": includefiles, "excludes": excludes, "compressed": True}},
options={"build_exe": {"include_files": ['LICENSE.txt'], "compressed": True}},
executables=[Executable(MAIN,
base=base,
targetName="KCC.exe",
@@ -40,8 +51,9 @@ elif platform == "win32":
appendScriptToLibrary=False,
compress=True)])
else:
from cx_Freeze import setup, Executable
extra_options = dict(
options={"build_exe": {"include_files": includefiles, "excludes": excludes, "compressed": True}},
options={"build_exe": {"include_files": ['LICENSE.txt'], "compressed": True}},
executables=[Executable(MAIN,
icon="icons/comic2ebook.png",
copyDependentFiles=True,