From 5de492ffb66082703056003e1a756ca8041dd59d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Mon, 5 Jan 2015 08:43:15 +0100 Subject: [PATCH 1/5] Overhauled dependency check --- README.md | 4 ++-- kcc/KCC_gui.py | 9 ++++----- kcc/shared.py | 23 +++++++++++++---------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 6660277..e0fd268 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,10 @@ You can find the latest released binary at the following links: ### For running from source: - Python 3.3+ -- [PyQt5](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.0+ +- [PyQt](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.0+ - [Pillow](http://pypi.python.org/pypi/Pillow/) 2.7.0+ - [psutil](https://pypi.python.org/pypi/psutil) 2.0+ -- [python-slugify](http://pypi.python.org/pypi/python-slugify) +- [python-slugify](http://pypi.python.org/pypi/python-slugify) 0.1.0+ On Debian based distributions these two commands should install all dependencies: ``` diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index 2a3780e..1b0c013 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -37,6 +37,7 @@ from PyQt5 import QtGui, QtCore, QtWidgets, QtNetwork from xml.dom.minidom import parse from psutil import Popen, Process from copy import copy +from distutils.version import StrictVersion from .shared import md5Checksum, HTMLStripper from . import comic2ebook from . import KCC_rc_web @@ -244,7 +245,7 @@ class VersionThread(QtCore.QThread): except Exception: return latestVersion = XML.childNodes[0].getElementsByTagName('latest')[0].childNodes[0].toxml() - if tuple(map(int, (latestVersion.split(".")))) > tuple(map(int, (__version__.split(".")))): + if StrictVersion(latestVersion) > StrictVersion(__version__): if sys.platform.startswith('win'): self.newVersion = latestVersion self.md5 = XML.childNodes[0].getElementsByTagName('WindowsMD5')[0].childNodes[0].toxml() @@ -1045,11 +1046,9 @@ class KCCGUI(KCC_ui.Ui_KCC): line = line.decode("utf-8") if 'Amazon kindlegen' in line: versionCheck = line.split('V')[1].split(' ')[0] - if tuple(map(int, (versionCheck.split(".")))) < tuple(map(int, ('2.9'.split(".")))): + if StrictVersion(versionCheck) < StrictVersion('2.9'): self.addMessage('Your KindleGen is outdated! Creating MOBI might fail.' - ' Please update KindleGen from Amazon\'s website.', 'warning') + '1000765211">KindleGen is outdated! MOBI conversion might fail.', 'warning') break else: self.KindleGen = False diff --git a/kcc/shared.py b/kcc/shared.py index b8c7334..5a6602b 100644 --- a/kcc/shared.py +++ b/kcc/shared.py @@ -23,6 +23,7 @@ __docformat__ = 'restructuredtext en' import os from hashlib import md5 from html.parser import HTMLParser +from distutils.version import StrictVersion class HTMLStripper(HTMLParser): @@ -81,25 +82,27 @@ def dependencyCheck(level): missing = [] if level > 2: try: - from PyQt5 import QtCore, QtNetwork, QtWidgets - if tuple(map(int, ('5.2.0'.split(".")))) > tuple(map(int, (QtCore.qVersion().split(".")))): - missing.append('PyQt5 5.2.0+') + from PyQt5.QtCore import qVersion as qtVersion + if StrictVersion('5.2.0') > StrictVersion(qtVersion()): + missing.append('PyQt 5.2.0+') except ImportError: - missing.append('PyQt5 5.2.0+') + missing.append('PyQt 5.2.0+') if level > 1: try: - import psutil - if tuple(map(int, ('2.0.0'.split(".")))) > tuple(map(int, psutil.version_info)): + from psutil import __version__ as psutilVersion + if StrictVersion('2.0.0') > StrictVersion(psutilVersion): missing.append('psutil 2.0.0+') except ImportError: missing.append('psutil 2.0.0+') try: - import slugify + from slugify import __version__ as slugifyVersion + if StrictVersion('0.1.0') > StrictVersion(slugifyVersion): + missing.append('python-slugify 0.1.0+') except ImportError: - missing.append('python-slugify') + missing.append('python-slugify 0.1.0+') try: - import PIL - if tuple(map(int, ('2.7.0'.split(".")))) > tuple(map(int, (PIL.PILLOW_VERSION.split(".")))): + from PIL import PILLOW_VERSION as pillowVersion + if StrictVersion('2.7.0') > StrictVersion(pillowVersion): missing.append('Pillow 2.7.0+') except ImportError: missing.append('Pillow 2.7.0+') From f2d6d5b45843cc684ad5ed0b7f12e4529646b47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Mon, 5 Jan 2015 10:47:21 +0100 Subject: [PATCH 2/5] Fixed upgrade freeze (close #123) --- kcc/KCC_gui.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index 1b0c013..13912ac 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -104,7 +104,6 @@ class QMainWindowKCC(QtWidgets.QMainWindow): showDialog = QtCore.pyqtSignal(str, str) hideProgressBar = QtCore.pyqtSignal() forceShutdown = QtCore.pyqtSignal() - dialogAnswer = QtCore.pyqtSignal(int) class Icons: @@ -234,6 +233,8 @@ class VersionThread(QtCore.QThread): QtCore.QThread.__init__(self) self.newVersion = '' self.md5 = '' + self.barProgress = 0 + self.answer = None def __del__(self): self.wait() @@ -250,17 +251,23 @@ class VersionThread(QtCore.QThread): self.newVersion = latestVersion self.md5 = XML.childNodes[0].getElementsByTagName('WindowsMD5')[0].childNodes[0].toxml() MW.showDialog.emit('New version released! ' - 'See changelog.<

Installed version: ' + __version__ + + 'See changelog.

Installed version: ' + __version__ + '
Current version: ' + latestVersion + '

Would you like to start automatic update?', 'question') + self.getNewVersion() else: MW.addMessage.emit('' 'New version is available! ' '(' 'Changelog)', 'warning', False) - def getNewVersion(self, dialogAnswer): - if dialogAnswer == QtWidgets.QMessageBox.Yes: + def setAnswer(self, dialogAnswer): + self.answer = dialogAnswer + + def getNewVersion(self): + while self.answer is None: + sleep(1) + if self.answer == QtWidgets.QMessageBox.Yes: try: MW.modeConvert.emit(-1) MW.progressBarTick.emit('Downloading update') @@ -279,9 +286,12 @@ class VersionThread(QtCore.QThread): MW.modeConvert.emit(1) def getNewVersionTick(self, size, blockSize, totalSize): + progress = int((size / (totalSize // blockSize)) * 100) if size == 0: - MW.progressBarTick.emit(str(int(totalSize / blockSize))) - MW.progressBarTick.emit('tick') + MW.progressBarTick.emit('100') + if progress > self.barProgress: + self.barProgress = progress + MW.progressBarTick.emit('tick') class ProgressThread(QtCore.QThread): @@ -885,9 +895,9 @@ class KCCGUI(KCC_ui.Ui_KCC): if kind == 'error': QtWidgets.QMessageBox.critical(MW, 'KCC - Error', message, QtWidgets.QMessageBox.Ok) elif kind == 'question': - dialogResponse = QtWidgets.QMessageBox.question(MW, 'KCC - Question', message, - QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No) - MW.dialogAnswer.emit(dialogResponse) + GUI.versionCheck.setAnswer(QtWidgets.QMessageBox.question(MW, 'KCC - Question', message, + QtWidgets.QMessageBox.Yes, + QtWidgets.QMessageBox.No)) def updateProgressbar(self, command): if command == 'tick': @@ -1230,7 +1240,6 @@ class KCCGUI(KCC_ui.Ui_KCC): MW.showDialog.connect(self.showDialog) MW.hideProgressBar.connect(self.hideProgressBar) MW.forceShutdown.connect(self.forceShutdown) - MW.dialogAnswer.connect(self.versionCheck.getNewVersion) MW.closeEvent = self.saveSettings MW.addTrayMessage.connect(self.tray.addTrayMessage) From 98bf28a713a161466673d09f7c2f556757577ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sat, 10 Jan 2015 11:09:28 +0100 Subject: [PATCH 3/5] Fixed OSX GUI anomalies --- kcc/KCC_gui.py | 6 ------ setup.py | 5 +---- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index 13912ac..baaf2f9 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -1077,16 +1077,10 @@ class KCCGUI(KCC_ui.Ui_KCC): MW = KCCWindow GUI = self self.setupUi(MW) - # User settings will be reverted to default ones if were created in one of the following versions - # Empty string cover all versions before this system was implemented - purgeSettingsVersions = [''] self.icons = Icons() self.webContent = KCC_rc_web.WebContent() self.settings = QtCore.QSettings('KindleComicConverter', 'KindleComicConverter') self.settingsVersion = self.settings.value('settingsVersion', '', type=str) - if self.settingsVersion in purgeSettingsVersions: - QtCore.QSettings.clear(self.settings) - self.settingsVersion = self.settings.value('settingsVersion', '', type=str) self.lastPath = self.settings.value('lastPath', '', type=str) self.lastDevice = self.settings.value('lastDevice', 0, type=int) self.currentMode = self.settings.value('currentMode', 1, type=int) diff --git a/setup.py b/setup.py index a75f07f..2d3698d 100755 --- a/setup.py +++ b/setup.py @@ -26,8 +26,7 @@ if platform == "darwin": py2app=dict( argv_emulation=True, iconfile='icons/comic2ebook.icns', - includes=['PIL', 'sip', 'PyQt5', 'PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtNetwork', 'PyQt5.QtWidgets', - 'PyQt5.QtPrintSupport'], + includes=['sip', 'PyQt5.QtPrintSupport'], resources=['LICENSE.txt', 'other/qt.conf', 'other/Additional-LICENSE.txt', 'other/unrar', 'other/7za'], plist=dict( CFBundleName=NAME, @@ -35,8 +34,6 @@ if platform == "darwin": CFBundleGetInfoString=NAME + " " + VERSION + ", written 2012-2015 by Ciro Mattia Gonano and Pawel Jastrzebski", CFBundleExecutable=NAME, - CFBundleIdentifier='com.github.ciromattia.kcc', - CFBundleSignature='dplt', CFBundleDocumentTypes=[ dict( CFBundleTypeExtensions=['cbz', 'cbr', 'cb7', 'zip', 'rar', '7z', 'pdf'], From c6b1417d9c79fadf0f36890c84c8a727da1418b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sun, 11 Jan 2015 16:17:04 +0100 Subject: [PATCH 4/5] Added one Windows DLL --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 2d3698d..a04e088 100755 --- a/setup.py +++ b/setup.py @@ -66,6 +66,7 @@ elif platform == "win32": 'other\\7za.exe', 'other\\UnRAR.exe', 'other\\Additional-LICENSE.txt', + 'C:\Python34' + suffix + '\Lib\site-packages\PyQt5\libGLESv2.dll', 'C:\Python34' + suffix + '\Lib\site-packages\PyQt5\libEGL.dll'])] extra_options = dict( options={'py2exe': {"bundle_files": 1, From 7bd9c766cc022f182ce8f268d797ed3c129f58d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sun, 11 Jan 2015 16:20:01 +0100 Subject: [PATCH 5/5] Version bump --- README.md | 4 ++++ kcc-c2e.py | 2 +- kcc-c2p.py | 2 +- kcc.iss | 2 +- kcc.py | 2 +- kcc/KCC_gui.py | 2 +- kcc/__init__.py | 2 +- kcc/comic2ebook.py | 2 +- kcc/comic2panel.py | 2 +- kcc/image.py | 2 +- setup.py | 2 +- setup.sh | 2 +- 12 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index e0fd268..84dfcda 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,10 @@ The app relies and includes the following scripts: * [Kobo Aura H2O](http://kcc.iosphe.re/Samples/Ubunchu!-KoAH2O.cbz) ## CHANGELOG +####4.4.1: +* Fixed problems with OSX GUI +* Added one missing DLL to Windows installer + ####4.4: * Improved speed and quality of conversion * Added RAR5 support diff --git a/kcc-c2e.py b/kcc-c2e.py index cbc5f20..97a4fa6 100755 --- a/kcc-c2e.py +++ b/kcc-c2e.py @@ -18,7 +18,7 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -__version__ = '4.4' +__version__ = '4.4.1' __license__ = 'ISC' __copyright__ = '2012-2015, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/kcc-c2p.py b/kcc-c2p.py index 674e67f..451ce9f 100755 --- a/kcc-c2p.py +++ b/kcc-c2p.py @@ -18,7 +18,7 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -__version__ = '4.4' +__version__ = '4.4.1' __license__ = 'ISC' __copyright__ = '2012-2015, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/kcc.iss b/kcc.iss index 8c6b275..3cb709a 100644 --- a/kcc.iss +++ b/kcc.iss @@ -1,5 +1,5 @@ #define MyAppName "Kindle Comic Converter" -#define MyAppVersion "4.4" +#define MyAppVersion "4.4.1" #define MyAppPublisher "Ciro Mattia Gonano, Paweł Jastrzębski" #define MyAppURL "http://kcc.iosphe.re/" #define MyAppExeName "KCC.exe" diff --git a/kcc.py b/kcc.py index 34d6102..589fedf 100755 --- a/kcc.py +++ b/kcc.py @@ -18,7 +18,7 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -__version__ = '4.4' +__version__ = '4.4.1' __license__ = 'ISC' __copyright__ = '2012-2015, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index baaf2f9..b608e42 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -17,7 +17,7 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -__version__ = '4.4' +__version__ = '4.4.1' __license__ = 'ISC' __copyright__ = '2012-2015, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/kcc/__init__.py b/kcc/__init__.py index 7b32d0a..c878e0a 100644 --- a/kcc/__init__.py +++ b/kcc/__init__.py @@ -1,4 +1,4 @@ -__version__ = '4.4' +__version__ = '4.4.1' __license__ = 'ISC' __copyright__ = '2012-2015, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' \ No newline at end of file diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 8cb2edd..0de5f71 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -18,7 +18,7 @@ # PERFORMANCE OF THIS SOFTWARE. # -__version__ = '4.4' +__version__ = '4.4.1' __license__ = 'ISC' __copyright__ = '2012-2015, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/kcc/comic2panel.py b/kcc/comic2panel.py index a9462ca..277f4c7 100644 --- a/kcc/comic2panel.py +++ b/kcc/comic2panel.py @@ -18,7 +18,7 @@ # PERFORMANCE OF THIS SOFTWARE. # -__version__ = '4.4' +__version__ = '4.4.1' __license__ = 'ISC' __copyright__ = '2012-2015, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/kcc/image.py b/kcc/image.py index 228bbae..618b9ff 100755 --- a/kcc/image.py +++ b/kcc/image.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -__version__ = '4.4' +__version__ = '4.4.1' __license__ = 'ISC' __copyright__ = '2012-2015, Ciro Mattia Gonano , Pawel Jastrzebski ' __docformat__ = 'restructuredtext en' diff --git a/setup.py b/setup.py index a04e088..2621bd0 100755 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ if version_info[0] != 3: exit(1) NAME = "KindleComicConverter" -VERSION = "4.4" +VERSION = "4.4.1" MAIN = "kcc.py" if platform == "darwin": diff --git a/setup.sh b/setup.sh index 01ea98f..fa4d85d 100755 --- a/setup.sh +++ b/setup.sh @@ -1,7 +1,7 @@ #!/bin/bash # Linux Python package build script -VERSION="4.4" +VERSION="4.4.1" cp kcc.py __main__.py zip kcc.zip __main__.py kcc/*.py