From b8e314f6cafe0c1453d80edd298ad3f297cd7514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Thu, 8 Dec 2016 10:36:05 +0100 Subject: [PATCH 01/11] Improved processing of credit pages --- kcc/comic2ebook.py | 4 ++-- kcc/image.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index e16ea4f..3cdc7c9 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -820,10 +820,10 @@ def detectCorruption(tmpPath, orgPath): else: saferRemove(os.path.join(root, name)) if imageSmaller > imageNumber * 0.25 and not options.upscale and not options.stretch: - print("WARNING: More than 1/4 of images are smaller than target device resolution. " + print("WARNING: More than 25% of images are smaller than target device resolution. " "Consider enabling stretching or upscaling to improve readability.") if GUI: - GUI.addMessage.emit('More than 1/4 of images are smaller than target device resolution.', 'warning', False) + GUI.addMessage.emit('More than 25% of images are smaller than target device resolution.', 'warning', False) GUI.addMessage.emit('Consider enabling stretching or upscaling to improve readability.', 'warning', False) GUI.addMessage.emit('', '', False) diff --git a/kcc/image.py b/kcc/image.py index 682ae45..28098e7 100755 --- a/kcc/image.py +++ b/kcc/image.py @@ -119,15 +119,15 @@ class ComicPageParser: def splitCheck(self): width, height = self.image.size dstwidth, dstheight = self.size - # Only split if origin is not oriented the same as target - if (width > height) != (dstwidth > dstheight) and not self.opt.webtoon: + if (width > height) != (dstwidth > dstheight) and width <= dstheight and height <= dstwidth \ + and not self.opt.webtoon: + self.payload.append(['R', self.source, self.image.rotate(90, Image.BICUBIC, True), self.color, self.fill]) + elif (width > height) != (dstwidth > dstheight) and not self.opt.webtoon: if self.opt.splitter != 1: if width > height: - # Source is landscape, so split by the width leftbox = (0, 0, int(width / 2), height) rightbox = (int(width / 2), 0, width, height) else: - # Source is portrait and target is landscape, so split by the height leftbox = (0, 0, width, int(height / 2)) rightbox = (0, int(height / 2), width, height) if self.opt.righttoleft: From 45c1afcad4bff454f99d10e177ee862589bdc3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Fri, 20 Jan 2017 09:44:21 +0100 Subject: [PATCH 02/11] Update build environment --- .gitignore | 2 +- LICENSE.txt | 2 +- README.md | 2 +- docker/Build | 2 +- docker/Dockerfile | 5 +---- kcc-c2e.py | 8 ++++---- kcc-c2p.py | 8 ++++---- kcc.iss | 2 +- kcc.py | 8 ++++---- {kcc => kindlecomicconverter}/KCC_gui.py | 2 +- {kcc => kindlecomicconverter}/KCC_rc.py | 0 {kcc => kindlecomicconverter}/KCC_ui.py | 0 {kcc => kindlecomicconverter}/KCC_ui_editor.py | 0 {kcc => kindlecomicconverter}/__init__.py | 2 +- {kcc => kindlecomicconverter}/cbxarchive.py | 2 +- {kcc => kindlecomicconverter}/comic2ebook.py | 2 +- {kcc => kindlecomicconverter}/comic2panel.py | 2 +- {kcc => kindlecomicconverter}/dualmetafix.py | 2 +- {kcc => kindlecomicconverter}/image.py | 2 +- {kcc => kindlecomicconverter}/kindle.py | 2 +- {kcc => kindlecomicconverter}/metadata.py | 2 +- {kcc => kindlecomicconverter}/pdfjpgextract.py | 2 +- {kcc => kindlecomicconverter}/rarfile.py | 0 {kcc => kindlecomicconverter}/shared.py | 2 +- other/osx/Info.plist | 2 +- setup.py | 18 ++++++++++++------ 26 files changed, 42 insertions(+), 39 deletions(-) rename {kcc => kindlecomicconverter}/KCC_gui.py (99%) rename {kcc => kindlecomicconverter}/KCC_rc.py (100%) rename {kcc => kindlecomicconverter}/KCC_ui.py (100%) rename {kcc => kindlecomicconverter}/KCC_ui_editor.py (100%) rename {kcc => kindlecomicconverter}/__init__.py (66%) rename {kcc => kindlecomicconverter}/cbxarchive.py (98%) rename {kcc => kindlecomicconverter}/comic2ebook.py (99%) rename {kcc => kindlecomicconverter}/comic2panel.py (99%) rename {kcc => kindlecomicconverter}/dualmetafix.py (99%) rename {kcc => kindlecomicconverter}/image.py (99%) rename {kcc => kindlecomicconverter}/kindle.py (96%) rename {kcc => kindlecomicconverter}/metadata.py (99%) rename {kcc => kindlecomicconverter}/pdfjpgextract.py (97%) rename {kcc => kindlecomicconverter}/rarfile.py (100%) rename {kcc => kindlecomicconverter}/shared.py (98%) diff --git a/.gitignore b/.gitignore index b28f15b..e5b7ef0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,5 +12,5 @@ kindlegen* *.spec setup.bat setup.sh -kcc/sentry.py +kindlecomicconverter/sentry.py build/ diff --git a/LICENSE.txt b/LICENSE.txt index cfe3e84..5d0945e 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,7 +1,7 @@ ISC LICENSE Copyright (c) 2012-2014 Ciro Mattia Gonano -Copyright (c) 2013-2016 Paweł Jastrzębski +Copyright (c) 2013-2017 Paweł Jastrzębski Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the diff --git a/README.md b/README.md index 3f8b676..b124454 100644 --- a/README.md +++ b/README.md @@ -495,5 +495,5 @@ The app relies and includes the following scripts: Please check [wiki page](https://github.com/ciromattia/kcc/wiki/Known-issues). ## COPYRIGHT -Copyright (c) 2012-2016 Ciro Mattia Gonano and Paweł Jastrzębski. +Copyright (c) 2012-2017 Ciro Mattia Gonano and Paweł Jastrzębski. **KCC** is released under ISC LICENSE; see LICENSE.txt for further details. diff --git a/docker/Build b/docker/Build index 67c7b7f..6135fb9 100755 --- a/docker/Build +++ b/docker/Build @@ -2,7 +2,7 @@ set -e pip3 install --upgrade pip setuptools wheel -pip3 install pillow python-slugify psutil pyinstaller==3.1.1 raven pyqt5 certifi +pip3 install pillow python-slugify psutil pyinstaller raven pyqt5 certifi gem install fpm cd /app diff --git a/docker/Dockerfile b/docker/Dockerfile index 5164aff..784bfac 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,12 +6,9 @@ ADD ./Build /Build RUN printf "deb http://httpredir.debian.org/debian stretch main" > /etc/apt/sources.list.d/stretch.list RUN printf "Package: *\nPin: release a=testing\nPin-Priority: 400\n" > /etc/apt/preferences.d/stretch.pref -RUN printf "deb http://httpredir.debian.org/debian sid main" > /etc/apt/sources.list.d/sid.list -RUN printf "Package: *\nPin: release a=testing\nPin-Priority: 300\n" > /etc/apt/preferences.d/sid.pref RUN apt-get update && apt-get -y dist-upgrade RUN apt-get -y install build-essential curl ruby ruby-dev libpng-dev libjpeg-dev -RUN apt-get -y -t testing install python3 python3-dev -RUN apt-get -y -t unstable install python3-pyqt5 +RUN apt-get -y -t testing install python3 python3-dev python3-pyqt5 RUN curl https://bootstrap.pypa.io/get-pip.py | python3 RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/kcc-c2e.py b/kcc-c2e.py index c98ae0b..cb83188 100755 --- a/kcc-c2e.py +++ b/kcc-c2e.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the @@ -23,12 +23,12 @@ if sys.version_info[0] != 3: print('ERROR: This is Python 3 script!') exit(1) -from kcc.shared import dependencyCheck +from kindlecomicconverter.shared import dependencyCheck dependencyCheck(2) from multiprocessing import freeze_support -from kcc import __version__ -from kcc.comic2ebook import main +from kindlecomicconverter import __version__ +from kindlecomicconverter.comic2ebook import main if __name__ == "__main__": freeze_support() diff --git a/kcc-c2p.py b/kcc-c2p.py index adab111..bc6aa6b 100755 --- a/kcc-c2p.py +++ b/kcc-c2p.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the @@ -23,12 +23,12 @@ if sys.version_info[0] != 3: print('ERROR: This is Python 3 script!') exit(1) -from kcc.shared import dependencyCheck +from kindlecomicconverter.shared import dependencyCheck dependencyCheck(1) from multiprocessing import freeze_support -from kcc import __version__ -from kcc.comic2panel import main +from kindlecomicconverter import __version__ +from kindlecomicconverter.comic2panel import main if __name__ == "__main__": freeze_support() diff --git a/kcc.iss b/kcc.iss index 9f0e8e6..b001db0 100644 --- a/kcc.iss +++ b/kcc.iss @@ -12,7 +12,7 @@ AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} -AppCopyright=Copyright (C) 2012-2016 Ciro Mattia Gonano and Paweł Jastrzębski +AppCopyright=Copyright (C) 2012-2017 Ciro Mattia Gonano and Paweł Jastrzębski ArchitecturesAllowed=x64 DefaultDirName={pf}\{#MyAppName} DefaultGroupName={#MyAppName} diff --git a/kcc.py b/kcc.py index 28045fc..a93e48f 100755 --- a/kcc.py +++ b/kcc.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the @@ -59,15 +59,15 @@ elif sys.platform.startswith('win'): # Load additional Sentry configuration if getattr(sys, 'frozen', False): try: - import kcc.sentry + import kindlecomicconverter.sentry except: pass -from kcc.shared import dependencyCheck +from kindlecomicconverter.shared import dependencyCheck dependencyCheck(3) from multiprocessing import freeze_support -from kcc import KCC_gui +from kindlecomicconverter import KCC_gui if __name__ == "__main__": freeze_support() diff --git a/kcc/KCC_gui.py b/kindlecomicconverter/KCC_gui.py similarity index 99% rename from kcc/KCC_gui.py rename to kindlecomicconverter/KCC_gui.py index b60c2be..16952ab 100644 --- a/kcc/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the diff --git a/kcc/KCC_rc.py b/kindlecomicconverter/KCC_rc.py similarity index 100% rename from kcc/KCC_rc.py rename to kindlecomicconverter/KCC_rc.py diff --git a/kcc/KCC_ui.py b/kindlecomicconverter/KCC_ui.py similarity index 100% rename from kcc/KCC_ui.py rename to kindlecomicconverter/KCC_ui.py diff --git a/kcc/KCC_ui_editor.py b/kindlecomicconverter/KCC_ui_editor.py similarity index 100% rename from kcc/KCC_ui_editor.py rename to kindlecomicconverter/KCC_ui_editor.py diff --git a/kcc/__init__.py b/kindlecomicconverter/__init__.py similarity index 66% rename from kcc/__init__.py rename to kindlecomicconverter/__init__.py index 8fd5a24..c0a62f7 100644 --- a/kcc/__init__.py +++ b/kindlecomicconverter/__init__.py @@ -1,4 +1,4 @@ __version__ = '5.2.1' __license__ = 'ISC' -__copyright__ = '2012-2016, Ciro Mattia Gonano , Pawel Jastrzebski ' +__copyright__ = '2012-2017, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/kcc/cbxarchive.py b/kindlecomicconverter/cbxarchive.py similarity index 98% rename from kcc/cbxarchive.py rename to kindlecomicconverter/cbxarchive.py index 3c857e7..726432b 100644 --- a/kcc/cbxarchive.py +++ b/kindlecomicconverter/cbxarchive.py @@ -1,5 +1,5 @@ # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the diff --git a/kcc/comic2ebook.py b/kindlecomicconverter/comic2ebook.py similarity index 99% rename from kcc/comic2ebook.py rename to kindlecomicconverter/comic2ebook.py index 3cdc7c9..e5bcc89 100755 --- a/kcc/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the diff --git a/kcc/comic2panel.py b/kindlecomicconverter/comic2panel.py similarity index 99% rename from kcc/comic2panel.py rename to kindlecomicconverter/comic2panel.py index 5e2b4f9..522587c 100644 --- a/kcc/comic2panel.py +++ b/kindlecomicconverter/comic2panel.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the diff --git a/kcc/dualmetafix.py b/kindlecomicconverter/dualmetafix.py similarity index 99% rename from kcc/dualmetafix.py rename to kindlecomicconverter/dualmetafix.py index ffb9890..566ceb5 100644 --- a/kcc/dualmetafix.py +++ b/kindlecomicconverter/dualmetafix.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # Based on initial version of DualMetaFix. Copyright (C) 2013 Kevin Hendricks -# Changes for KCC Copyright (C) 2014-2016 Pawel Jastrzebski +# Changes for KCC Copyright (C) 2014-2017 Pawel Jastrzebski # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/kcc/image.py b/kindlecomicconverter/image.py similarity index 99% rename from kcc/image.py rename to kindlecomicconverter/image.py index 28098e7..b83bea7 100755 --- a/kcc/image.py +++ b/kindlecomicconverter/image.py @@ -2,7 +2,7 @@ # Copyright (C) 2011 Stanislav (proDOOMman) Kosolapov # Copyright (c) 2016 Alberto Planas # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/kcc/kindle.py b/kindlecomicconverter/kindle.py similarity index 96% rename from kcc/kindle.py rename to kindlecomicconverter/kindle.py index 90e15e1..1eea63c 100644 --- a/kcc/kindle.py +++ b/kindlecomicconverter/kindle.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the diff --git a/kcc/metadata.py b/kindlecomicconverter/metadata.py similarity index 99% rename from kcc/metadata.py rename to kindlecomicconverter/metadata.py index 2dd51c5..f2cf488 100644 --- a/kcc/metadata.py +++ b/kindlecomicconverter/metadata.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the diff --git a/kcc/pdfjpgextract.py b/kindlecomicconverter/pdfjpgextract.py similarity index 97% rename from kcc/pdfjpgextract.py rename to kindlecomicconverter/pdfjpgextract.py index 06403ad..90d0643 100644 --- a/kcc/pdfjpgextract.py +++ b/kindlecomicconverter/pdfjpgextract.py @@ -1,5 +1,5 @@ # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Based upon the code snippet by Ned Batchelder # (http://nedbatchelder.com/blog/200712/extracting_jpgs_from_pdfs.html) diff --git a/kcc/rarfile.py b/kindlecomicconverter/rarfile.py similarity index 100% rename from kcc/rarfile.py rename to kindlecomicconverter/rarfile.py diff --git a/kcc/shared.py b/kindlecomicconverter/shared.py similarity index 98% rename from kcc/shared.py rename to kindlecomicconverter/shared.py index c228d30..3843f39 100644 --- a/kcc/shared.py +++ b/kindlecomicconverter/shared.py @@ -1,5 +1,5 @@ # Copyright (c) 2012-2014 Ciro Mattia Gonano -# Copyright (c) 2013-2016 Pawel Jastrzebski +# Copyright (c) 2013-2017 Pawel Jastrzebski # # Permission to use, copy, modify, and/or distribute this software for # any purpose with or without fee is hereby granted, provided that the diff --git a/other/osx/Info.plist b/other/osx/Info.plist index 0eb9c94..d549ea2 100644 --- a/other/osx/Info.plist +++ b/other/osx/Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable MacOS/Kindle Comic Converter CFBundleGetInfoString - KindleComicConverter 5.2.1, written 2012-2016 by Ciro Mattia Gonano and Pawel Jastrzebski + KindleComicConverter 5.2.1, written 2012-2017 by Ciro Mattia Gonano and Pawel Jastrzebski CFBundleIconFile comic2ebook.icns CFBundleIdentifier diff --git a/setup.py b/setup.py index a1f1b73..827edc8 100755 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ import shutil import setuptools import distutils.cmd from distutils.command.build import build -from kcc import __version__ +from kindlecomicconverter import __version__ NAME = 'KindleComicConverter' MAIN = 'kcc.py' @@ -38,7 +38,10 @@ class BuildBinaryCommand(distutils.cmd.Command): def run(self): if sys.platform == 'darwin': - os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s --noupx kcc.py') + if os.path.isfile('KCC.spec'): + os.system('pyinstaller KCC.spec') + else: + os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s --noupx kcc.py') shutil.copy('other/osx/7za', 'dist/Kindle Comic Converter.app/Contents/Resources') shutil.copy('other/osx/unrar', 'dist/Kindle Comic Converter.app/Contents/Resources') shutil.copy('other/osx/Info.plist', 'dist/Kindle Comic Converter.app/Contents') @@ -51,7 +54,10 @@ class BuildBinaryCommand(distutils.cmd.Command): os.system('appdmg kcc.json dist/KindleComicConverter_osx_' + VERSION + '.dmg') exit(0) elif sys.platform == 'win32': - os.system('pyinstaller -y -F -i icons\comic2ebook.ico -n KCC -w --noupx kcc.py') + if os.path.isfile('KCC.spec'): + os.system('pyinstaller KCC.spec') + else: + os.system('pyinstaller -y -F -i icons\comic2ebook.ico -n KCC -w --noupx kcc.py') if os.path.isfile('setup.bat'): os.system('setup.bat') exit(0) @@ -59,19 +65,19 @@ class BuildBinaryCommand(distutils.cmd.Command): if self.pyz: script = ''' cp kcc.py __main__.py - zip kcc.zip __main__.py kcc/*.py + zip kcc.zip __main__.py kindlecomicconverter/*.py echo "#!/usr/bin/env python3" > kcc-bin cat kcc.zip >> kcc-bin chmod +x kcc-bin cp kcc-c2e.py __main__.py - zip kcc-c2e.zip __main__.py kcc/*.py + zip kcc-c2e.zip __main__.py kindlecomicconverter/*.py echo "#!/usr/bin/env python3" > kcc-c2e-bin cat kcc-c2e.zip >> kcc-c2e-bin chmod +x kcc-c2e-bin cp kcc-c2p.py __main__.py - zip kcc-c2p.zip __main__.py kcc/*.py + zip kcc-c2p.zip __main__.py kindlecomicconverter/*.py echo "#!/usr/bin/env python3" > kcc-c2p-bin cat kcc-c2p.zip >> kcc-c2p-bin chmod +x kcc-c2p-bin From aea7c0fafb204017462bafc1ae0844dfb9c7ec18 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Thu, 5 Jan 2017 20:27:30 +0300 Subject: [PATCH 03/11] Fix unreadable text with dark qt themes Fix unreadable text with dark qt themes #2 (file list) Tweaks --- gui/KCC.ui | 57 ++++----------------------------- kindlecomicconverter/KCC_gui.py | 2 +- kindlecomicconverter/KCC_ui.py | 2 +- 3 files changed, 8 insertions(+), 53 deletions(-) diff --git a/gui/KCC.ui b/gui/KCC.ui index 0b94d42..5dc8697 100644 --- a/gui/KCC.ui +++ b/gui/KCC.ui @@ -47,7 +47,7 @@ - QListWidget#jobList {background:#ffffff;background-image:url(:/Other/icons/list_background.png);background-position:center center;background-repeat:no-repeat;} + QListWidget#jobList {background:#ffffff;background-image:url(:/Other/icons/list_background.png);background-position:center center;background-repeat:no-repeat;color:rgb(0,0,0);} QAbstractItemView::NoSelection @@ -66,16 +66,7 @@ false - - 0 - - - 0 - - - 0 - - + 0 @@ -136,16 +127,7 @@ - - 0 - - - 0 - - - 0 - - + 0 @@ -256,16 +238,7 @@ false - - 0 - - - 0 - - - 0 - - + 0 @@ -294,16 +267,7 @@ - - 0 - - - 0 - - - 0 - - + 0 @@ -352,16 +316,7 @@ - - 0 - - - 0 - - - 0 - - + 0 diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index 16952ab..ca3d73f 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -672,7 +672,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow): # We still fill original text field with transparent content to trigger creation of horizontal scrollbar item.setForeground(QtGui.QColor('transparent')) label = QtWidgets.QLabel(message) - label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);') + label.setStyleSheet('background-image:url('');background-color:rgba(0,0,0,0);color:rgb(0,0,0);') label.setOpenExternalLinks(True) GUI.jobList.addItem(item) GUI.jobList.setItemWidget(item, label) diff --git a/kindlecomicconverter/KCC_ui.py b/kindlecomicconverter/KCC_ui.py index 6e2ed50..71689ab 100644 --- a/kindlecomicconverter/KCC_ui.py +++ b/kindlecomicconverter/KCC_ui.py @@ -31,7 +31,7 @@ class Ui_mainWindow(object): self.progressBar.setObjectName("progressBar") self.gridLayout.addWidget(self.progressBar, 1, 0, 1, 2) self.jobList = QtWidgets.QListWidget(self.centralWidget) - self.jobList.setStyleSheet("QListWidget#jobList {background:#ffffff;background-image:url(:/Other/icons/list_background.png);background-position:center center;background-repeat:no-repeat;}") + self.jobList.setStyleSheet("QListWidget#jobList {background:#ffffff;background-image:url(:/Other/icons/list_background.png);background-position:center center;background-repeat:no-repeat;color:rgb(0,0,0);}") self.jobList.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection) self.jobList.setVerticalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel) self.jobList.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel) From ee042ef98d1f032a947ffd19a4ba50e82dd3ad44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sat, 21 Jan 2017 22:21:58 +0100 Subject: [PATCH 04/11] Update build environment --- .gitignore | 1 + setup.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e5b7ef0..9e0e197 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ setup.bat setup.sh kindlecomicconverter/sentry.py build/ +.python-version diff --git a/setup.py b/setup.py index 827edc8..d355265 100755 --- a/setup.py +++ b/setup.py @@ -38,8 +38,8 @@ class BuildBinaryCommand(distutils.cmd.Command): def run(self): if sys.platform == 'darwin': - if os.path.isfile('KCC.spec'): - os.system('pyinstaller KCC.spec') + if os.path.isfile('Kindle Comic Converter.spec'): + os.system('pyinstaller "Kindle Comic Converter.spec"') else: os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s --noupx kcc.py') shutil.copy('other/osx/7za', 'dist/Kindle Comic Converter.app/Contents/Resources') From 2bea546a9d95733f29ac00877228567225e05c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sat, 21 Jan 2017 22:34:39 +0100 Subject: [PATCH 05/11] Re-enabled OS X file association mechanism --- other/osx/Info.plist | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/other/osx/Info.plist b/other/osx/Info.plist index d549ea2..4933a99 100644 --- a/other/osx/Info.plist +++ b/other/osx/Info.plist @@ -6,6 +6,27 @@ English CFBundleDisplayName Kindle Comic Converter + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + cbz + cbr + cb7 + zip + rar + 7z + pdf + + CFBundleTypeIconFile + comic2ebook.icns + CFBundleTypeName + Comics + CFBundleTypeRole + Editor + + CFBundleExecutable MacOS/Kindle Comic Converter CFBundleGetInfoString From 495db88a9e91d656908df84b2140846c1a9758ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Wed, 1 Feb 2017 17:32:48 +0100 Subject: [PATCH 06/11] Re-enabled Panel View support for Kindle Keyboard --- kindlecomicconverter/KCC_gui.py | 2 +- kindlecomicconverter/comic2ebook.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index ca3d73f..63f004c 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -934,7 +934,7 @@ class KCCGUI(KCC_ui.Ui_mainWindow): 'DefaultUpscale': False, 'Label': 'K1'}, "Kindle 2": {'PVOptions': False, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': False, 'Label': 'K2'}, - "Kindle 3": {'PVOptions': False, 'ForceExpert': False, 'DefaultFormat': 0, + "Kindle 3": {'PVOptions': True, 'ForceExpert': False, 'DefaultFormat': 0, 'DefaultUpscale': False, 'Label': 'K3'}, } profilesGUI = [ diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index e5bcc89..9580dab 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -943,8 +943,8 @@ def checkOptions(): # Splitting MOBI is not optional if options.format == 'MOBI' and options.batchsplit != 2: options.batchsplit = 1 - # Older Kindle don't need higher resolution files due lack of Panel View. - if options.profile == 'K1' or options.profile == 'K2' or options.profile == 'K3' or options.profile == 'KDX': + # Older Kindle models don't support Panel View. + if options.profile == 'K1' or options.profile == 'K2' or options.profile == 'KDX': options.panelview = False # Webtoon mode mandatory options if options.webtoon: From 02b9081e37fdbdeef9bcaf1e386df41350163fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sat, 4 Feb 2017 10:31:09 +0100 Subject: [PATCH 07/11] Improved compatibility with non-Kindle devices --- kindlecomicconverter/comic2ebook.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 9580dab..404ca11 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -106,6 +106,7 @@ def buildHTML(path, imgfile, imgfilepath): if not os.path.exists(htmlpath): os.makedirs(htmlpath) htmlfile = os.path.join(htmlpath, filename[0] + '.xhtml') + imgsize = Image.open(os.path.join(head, "Images", postfix, imgfile)).size f = open(htmlfile, "w", encoding='UTF-8') f.writelines(["\n", "\n", @@ -116,14 +117,15 @@ def buildHTML(path, imgfile, imgfilepath): "\n" "\n", - "\n"]) + "\n", + "
\n", + "\n
\n"]) if options.iskindle and options.panelview: - sizeTmp = Image.open(os.path.join(head, "Images", postfix, imgfile)).size if options.autoscale: - size = (getPanelViewResolution(sizeTmp, deviceres)) + size = (getPanelViewResolution(imgsize, deviceres)) else: - size = (int(sizeTmp[0] * 1.5), int(sizeTmp[1] * 1.5)) + size = (int(imgsize[0] * 1.5), int(imgsize[1] * 1.5)) if size[0] - deviceres[0] < deviceres[0] * 0.01: noHorizontalPV = True else: @@ -356,9 +358,6 @@ def buildEPUB(path, chapterNames, tomeNumber): "display: block;\n", "margin: 0;\n", "padding: 0;\n", - "background-position: center center;\n", - "background-repeat: no-repeat;\n", - "background-size: auto auto;\n", "}\n", "#PV {\n", "position: absolute;\n", @@ -671,6 +670,11 @@ def getDirectorySize(start_path='.'): return total_size +def getTopMargin(deviceres, size): + y = int((deviceres[1] - size[1]) / 2) / deviceres[1] * 100 + return str(round(y, 1)) + + def getPanelViewResolution(imageSize, deviceRes): scale = float(deviceRes[0]) / float(imageSize[0]) return int(deviceRes[0]), int(scale * imageSize[1]) From e1470cca15e29b8ba5962b2632618c20c33053d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sun, 5 Feb 2017 08:35:34 +0100 Subject: [PATCH 08/11] Force admin rights for Windows version --- kcc.iss | 3 ++- other/windows/KCC.exe.manifest | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 other/windows/KCC.exe.manifest diff --git a/kcc.iss b/kcc.iss index b001db0..476b97c 100644 --- a/kcc.iss +++ b/kcc.iss @@ -46,6 +46,7 @@ Name: "CB7association"; Description: "CB7"; GroupDescription: "File associations [Files] Source: "dist\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion Source: "LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion solidbreak +Source: "other\windows\KCC.exe.manifest"; DestDir: "{app}"; Flags: ignoreversion Source: "other\windows\Additional-LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion Source: "other\windows\UnRAR.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "other\windows\7za.exe"; DestDir: "{app}"; Flags: ignoreversion @@ -58,7 +59,7 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: [Run] Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "Installing Microsoft Visual C++ 2015 Redistributable Package..." -Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall shellexec [Messages] WelcomeLabel1=Welcome to the KCC Setup Wizard diff --git a/other/windows/KCC.exe.manifest b/other/windows/KCC.exe.manifest new file mode 100644 index 0000000..360eea0 --- /dev/null +++ b/other/windows/KCC.exe.manifest @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 807a2d1dff99c26f1e945691f184d2f114051763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sun, 5 Feb 2017 08:53:09 +0100 Subject: [PATCH 09/11] Tweaked cover parsing --- kindlecomicconverter/image.py | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/kindlecomicconverter/image.py b/kindlecomicconverter/image.py index b83bea7..ecc08b9 100755 --- a/kindlecomicconverter/image.py +++ b/kindlecomicconverter/image.py @@ -345,34 +345,20 @@ class Cover: source = urlopen(Request(quote(self.options.remoteCovers[self.tomeNumber]).replace('%3A', ':', 1), headers={'User-Agent': 'KindleComicConverter/' + __version__})).read() self.image = Image.open(BytesIO(source)) - self.processExternal() except Exception: self.image = Image.open(source) - self.processInternal() else: self.image = Image.open(source) - self.processInternal() + self.process() - def processInternal(self): - self.image = self.image.convert('RGB') - self.image = self.trim() - self.save() - - def processExternal(self): + def process(self): self.image = self.image.convert('RGB') + self.image = ImageOps.autocontrast(self.image) + if not self.options.forcecolor: + self.image = self.image.convert('L') self.image.thumbnail(self.options.profileData[1], Image.LANCZOS) self.save() - def trim(self): - bg = Image.new(self.image.mode, self.image.size, self.image.getpixel((0, 0))) - diff = ImageChops.difference(self.image, bg) - diff = ImageChops.add(diff, diff, 2.0, -100) - bbox = diff.getbbox() - if bbox: - return self.image.crop(bbox) - else: - return self.image - def save(self): try: self.image.save(self.target, "JPEG", optimize=1, quality=80) @@ -380,7 +366,7 @@ class Cover: raise RuntimeError('Failed to process downloaded cover.') def saveToKindle(self, kindle, asin): - self.image = self.image.resize((300, 470), Image.ANTIALIAS).convert('L') + self.image = self.image.resize((300, 470), Image.ANTIALIAS) try: self.image.save(os.path.join(kindle.path.split('documents')[0], 'system', 'thumbnails', 'thumbnail_' + asin + '_EBOK_portrait.jpg'), 'JPEG') From 4b0a94a8a0c7ad439c6939617b4f88260f68817a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Mon, 6 Feb 2017 19:21:33 +0100 Subject: [PATCH 10/11] Revert "Force admin rights for Windows version" This reverts commit e1470cca15e29b8ba5962b2632618c20c33053d3. --- kcc.iss | 3 +-- other/windows/KCC.exe.manifest | 26 -------------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 other/windows/KCC.exe.manifest diff --git a/kcc.iss b/kcc.iss index 476b97c..b001db0 100644 --- a/kcc.iss +++ b/kcc.iss @@ -46,7 +46,6 @@ Name: "CB7association"; Description: "CB7"; GroupDescription: "File associations [Files] Source: "dist\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion Source: "LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion solidbreak -Source: "other\windows\KCC.exe.manifest"; DestDir: "{app}"; Flags: ignoreversion Source: "other\windows\Additional-LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion Source: "other\windows\UnRAR.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "other\windows\7za.exe"; DestDir: "{app}"; Flags: ignoreversion @@ -59,7 +58,7 @@ Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: [Run] Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "Installing Microsoft Visual C++ 2015 Redistributable Package..." -Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall shellexec +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall [Messages] WelcomeLabel1=Welcome to the KCC Setup Wizard diff --git a/other/windows/KCC.exe.manifest b/other/windows/KCC.exe.manifest deleted file mode 100644 index 360eea0..0000000 --- a/other/windows/KCC.exe.manifest +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 010ad3c88cea89dfd28a1980b43cc6e863775e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sun, 12 Feb 2017 09:11:18 +0100 Subject: [PATCH 11/11] Updated README + version bump --- README.md | 7 +++++++ kcc.iss | 2 +- kindlecomicconverter/__init__.py | 2 +- other/osx/Info.plist | 6 +++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b124454..d1c8ea8 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,13 @@ The app relies and includes the following scripts: * [Kobo Aura ONE](http://kcc.iosphe.re/Samples/Ubunchu-KoAO.kepub.epub) ## CHANGELOG +####5.3: +* Vastly improved output compatibility for non-Kindle devices +* Enabled old pinch zoom for Kindle devices +* Re-enabled Panel View support for Kindle Keyboard +* Partially re-enabled OS X file association mechanism +* Fixed multiple smaller issues + ####5.2.1: * Improved directory parsing * Tweaked margin detection algorithm diff --git a/kcc.iss b/kcc.iss index b001db0..7cd7685 100644 --- a/kcc.iss +++ b/kcc.iss @@ -1,5 +1,5 @@ #define MyAppName "Kindle Comic Converter" -#define MyAppVersion "5.2.1" +#define MyAppVersion "5.3.0" #define MyAppPublisher "Ciro Mattia Gonano, Paweł Jastrzębski" #define MyAppURL "http://kcc.iosphe.re/" #define MyAppExeName "KCC.exe" diff --git a/kindlecomicconverter/__init__.py b/kindlecomicconverter/__init__.py index c0a62f7..c966b7c 100644 --- a/kindlecomicconverter/__init__.py +++ b/kindlecomicconverter/__init__.py @@ -1,4 +1,4 @@ -__version__ = '5.2.1' +__version__ = '5.3.0' __license__ = 'ISC' __copyright__ = '2012-2017, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/other/osx/Info.plist b/other/osx/Info.plist index 4933a99..7600993 100644 --- a/other/osx/Info.plist +++ b/other/osx/Info.plist @@ -30,7 +30,7 @@ CFBundleExecutable MacOS/Kindle Comic Converter CFBundleGetInfoString - KindleComicConverter 5.2.1, written 2012-2017 by Ciro Mattia Gonano and Pawel Jastrzebski + KindleComicConverter 5.3.0, written 2012-2017 by Ciro Mattia Gonano and Pawel Jastrzebski CFBundleIconFile comic2ebook.icns CFBundleIdentifier @@ -42,11 +42,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 5.2.1 + 5.3.0 CFBundleSignature ???? CFBundleVersion - 5.2.1 + 5.3.0 LSEnvironment PATH