diff options
author | Paweł Jastrzębski <pawelj@vulturis.eu> | 2014-06-18 10:34:08 +0200 |
---|---|---|
committer | Paweł Jastrzębski <pawelj@iosphe.re> | 2014-07-03 18:16:56 +0200 |
commit | 39fbbc42b3047eff303f4d636279edf79ac7899c (patch) | |
tree | c325c0b5c75fba79d36d5a2de09bbfb3ca4740d2 | |
parent | Disabled ultra quality mode for CBZ format (diff) | |
download | kcc-39fbbc42b3047eff303f4d636279edf79ac7899c.tar.gz kcc-39fbbc42b3047eff303f4d636279edf79ac7899c.tar.bz2 kcc-39fbbc42b3047eff303f4d636279edf79ac7899c.zip |
Made KindleGen detection more foolproof
-rw-r--r-- | kcc/KCC_gui.py | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index 2ff0e93..70670d3 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -873,14 +873,7 @@ class KCCGUI(KCC_ui.Ui_KCC): if outputFormat is not None: GUI.FormatBox.setCurrentIndex(outputFormat) else: - if GUI.FormatBox.count() == 3: - GUI.FormatBox.setCurrentIndex(profile['DefaultFormat']) - else: - if profile['DefaultFormat'] != 0: - tmpFormat = profile['DefaultFormat'] - 1 - else: - tmpFormat = 0 - GUI.FormatBox.setCurrentIndex(tmpFormat) + GUI.FormatBox.setCurrentIndex(profile['DefaultFormat']) if GUI.WebtoonBox.isChecked(): GUI.MangaBox.setEnabled(False) GUI.QualityBox.setEnabled(False) @@ -975,6 +968,15 @@ class KCCGUI(KCC_ui.Ui_KCC): self.addMessage('Target resolution is not set!', 'error') self.needClean = True return + if str(GUI.FormatBox.currentText()) == 'MOBI' and not GUI.KindleGen: + self.addMessage('Cannot find <a href="http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211">' + '<b>KindleGen</b></a>! MOBI conversion is not possible!', 'error') + if sys.platform.startswith('win'): + self.addMessage('Download it and place EXE in KCC directory.', 'error') + else: + self.addMessage('Download it, and place executable in /usr/local/bin directory.', 'error') + self.needClean = True + return self.worker.start() def hideProgressBar(self): @@ -1198,7 +1200,6 @@ class KCCGUI(KCC_ui.Ui_KCC): kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True) if kindleGenExitCode.wait() == 0: self.KindleGen = True - formats = ['MOBI', 'EPUB', 'CBZ'] versionCheck = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True) for line in versionCheck.stdout: line = line.decode("utf-8") @@ -1212,13 +1213,6 @@ class KCCGUI(KCC_ui.Ui_KCC): break else: self.KindleGen = False - formats = ['EPUB', 'CBZ'] - if sys.platform.startswith('win'): - self.addMessage('Cannot find <a href="http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211">' - 'kindlegen</a> in KCC directory! MOBI creation will be disabled.', 'warning') - else: - self.addMessage('Cannot find <a href="http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211">' - 'kindlegen</a> in PATH! MOBI creation will be disabled.', 'warning') rarExitCode = Popen('unrar', stdout=PIPE, stderr=STDOUT, shell=True) rarExitCode = rarExitCode.wait() if rarExitCode == 0 or rarExitCode == 7: @@ -1273,7 +1267,7 @@ class KCCGUI(KCC_ui.Ui_KCC): GUI.DeviceBox.addItem(self.icons.deviceKobo, profile) else: GUI.DeviceBox.addItem(self.icons.deviceKindle, profile) - for f in formats: + for f in ['MOBI', 'EPUB', 'CBZ']: GUI.FormatBox.addItem(eval('self.icons.' + f + 'Format'), f) if self.lastDevice > GUI.DeviceBox.count(): self.lastDevice = 0 |