mirror of
https://github.com/ciromattia/kcc
synced 2025-12-19 04:31:50 +00:00
Made KindleGen detection more foolproof
This commit is contained in:
committed by
Paweł Jastrzębski
parent
99405ab8a6
commit
39fbbc42b3
@@ -873,14 +873,7 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
|||||||
if outputFormat is not None:
|
if outputFormat is not None:
|
||||||
GUI.FormatBox.setCurrentIndex(outputFormat)
|
GUI.FormatBox.setCurrentIndex(outputFormat)
|
||||||
else:
|
else:
|
||||||
if GUI.FormatBox.count() == 3:
|
|
||||||
GUI.FormatBox.setCurrentIndex(profile['DefaultFormat'])
|
GUI.FormatBox.setCurrentIndex(profile['DefaultFormat'])
|
||||||
else:
|
|
||||||
if profile['DefaultFormat'] != 0:
|
|
||||||
tmpFormat = profile['DefaultFormat'] - 1
|
|
||||||
else:
|
|
||||||
tmpFormat = 0
|
|
||||||
GUI.FormatBox.setCurrentIndex(tmpFormat)
|
|
||||||
if GUI.WebtoonBox.isChecked():
|
if GUI.WebtoonBox.isChecked():
|
||||||
GUI.MangaBox.setEnabled(False)
|
GUI.MangaBox.setEnabled(False)
|
||||||
GUI.QualityBox.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.addMessage('Target resolution is not set!', 'error')
|
||||||
self.needClean = True
|
self.needClean = True
|
||||||
return
|
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()
|
self.worker.start()
|
||||||
|
|
||||||
def hideProgressBar(self):
|
def hideProgressBar(self):
|
||||||
@@ -1198,7 +1200,6 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
|||||||
kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
|
kindleGenExitCode = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||||
if kindleGenExitCode.wait() == 0:
|
if kindleGenExitCode.wait() == 0:
|
||||||
self.KindleGen = True
|
self.KindleGen = True
|
||||||
formats = ['MOBI', 'EPUB', 'CBZ']
|
|
||||||
versionCheck = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
|
versionCheck = Popen('kindlegen -locale en', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||||
for line in versionCheck.stdout:
|
for line in versionCheck.stdout:
|
||||||
line = line.decode("utf-8")
|
line = line.decode("utf-8")
|
||||||
@@ -1212,13 +1213,6 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
|||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.KindleGen = False
|
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 = Popen('unrar', stdout=PIPE, stderr=STDOUT, shell=True)
|
||||||
rarExitCode = rarExitCode.wait()
|
rarExitCode = rarExitCode.wait()
|
||||||
if rarExitCode == 0 or rarExitCode == 7:
|
if rarExitCode == 0 or rarExitCode == 7:
|
||||||
@@ -1273,7 +1267,7 @@ class KCCGUI(KCC_ui.Ui_KCC):
|
|||||||
GUI.DeviceBox.addItem(self.icons.deviceKobo, profile)
|
GUI.DeviceBox.addItem(self.icons.deviceKobo, profile)
|
||||||
else:
|
else:
|
||||||
GUI.DeviceBox.addItem(self.icons.deviceKindle, profile)
|
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)
|
GUI.FormatBox.addItem(eval('self.icons.' + f + 'Format'), f)
|
||||||
if self.lastDevice > GUI.DeviceBox.count():
|
if self.lastDevice > GUI.DeviceBox.count():
|
||||||
self.lastDevice = 0
|
self.lastDevice = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user