mirror of
https://github.com/ciromattia/kcc
synced 2025-12-14 02:06:40 +00:00
Improved error handling
This commit is contained in:
@@ -213,6 +213,10 @@ The app relies and includes the following scripts/binaries:
|
|||||||
* Added support for custom width/height
|
* Added support for custom width/height
|
||||||
* Added option to disable color conversion
|
* Added option to disable color conversion
|
||||||
|
|
||||||
|
## KNOWN ISSUES
|
||||||
|
* _Add directory_ dialog allow to select multiple directories but they are not added to job list. [QT bug.](https://bugreports.qt-project.org/browse/QTBUG-21372)
|
||||||
|
* Removing SRCS headers sometimes fail in 32bit enviroments. Due to memory limitations.
|
||||||
|
|
||||||
## COPYRIGHT
|
## COPYRIGHT
|
||||||
|
|
||||||
Copyright (c) 2012-2013 Ciro Mattia Gonano and Paweł Jastrzębski.
|
Copyright (c) 2012-2013 Ciro Mattia Gonano and Paweł Jastrzębski.
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ class WorkerThread(QtCore.QThread):
|
|||||||
profile = ProfileData.ProfileLabels[str(GUI.DeviceBox.currentText())]
|
profile = ProfileData.ProfileLabels[str(GUI.DeviceBox.currentText())]
|
||||||
argv = ["--profile=" + profile]
|
argv = ["--profile=" + profile]
|
||||||
currentJobs = []
|
currentJobs = []
|
||||||
global errors
|
|
||||||
if GUI.MangaBox.isChecked():
|
if GUI.MangaBox.isChecked():
|
||||||
argv.append("--manga-style")
|
argv.append("--manga-style")
|
||||||
if GUI.RotateBox.isChecked():
|
if GUI.RotateBox.isChecked():
|
||||||
@@ -122,7 +121,7 @@ class WorkerThread(QtCore.QThread):
|
|||||||
currentJobs.append(str(GUI.JobList.item(i).text()))
|
currentJobs.append(str(GUI.JobList.item(i).text()))
|
||||||
GUI.JobList.clear()
|
GUI.JobList.clear()
|
||||||
for job in currentJobs:
|
for job in currentJobs:
|
||||||
errors = False
|
self.errors = False
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Source: ' + job, 'info')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Source: ' + job, 'info')
|
||||||
if str(GUI.FormatBox.currentText()) == 'CBZ':
|
if str(GUI.FormatBox.currentText()) == 'CBZ':
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Creating CBZ file...', 'info')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Creating CBZ file...', 'info')
|
||||||
@@ -134,15 +133,14 @@ class WorkerThread(QtCore.QThread):
|
|||||||
outputPath = comic2ebook.main(jobargv, self)
|
outputPath = comic2ebook.main(jobargv, self)
|
||||||
self.emit(QtCore.SIGNAL("hideProgressBar"))
|
self.emit(QtCore.SIGNAL("hideProgressBar"))
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
errors = True
|
self.errors = True
|
||||||
type_, value_, traceback_ = sys.exc_info()
|
type_, value_, traceback_ = sys.exc_info()
|
||||||
QtGui.QMessageBox.critical(MainWindow, 'KCC Error',
|
QtGui.QMessageBox.critical(MainWindow, 'KCC Error',
|
||||||
"Error on file %s:\n%s\nTraceback:\n%s"
|
"Error on file %s:\n%s\nTraceback:\n%s"
|
||||||
% (jobargv[-1], str(err), traceback.format_tb(traceback_)),
|
% (jobargv[-1], str(err), traceback.format_tb(traceback_)),
|
||||||
QtGui.QMessageBox.Ok)
|
QtGui.QMessageBox.Ok)
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'KCC failed to create EPUB!', 'error')
|
self.emit(QtCore.SIGNAL("addMessage"), 'KCC failed to create EPUB!', 'error')
|
||||||
continue
|
if not self.errors:
|
||||||
if not errors:
|
|
||||||
if str(GUI.FormatBox.currentText()) == 'CBZ':
|
if str(GUI.FormatBox.currentText()) == 'CBZ':
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Creating CBZ file... Done!', 'info', True)
|
self.emit(QtCore.SIGNAL("addMessage"), 'Creating CBZ file... Done!', 'info', True)
|
||||||
else:
|
else:
|
||||||
@@ -165,9 +163,8 @@ class WorkerThread(QtCore.QThread):
|
|||||||
try:
|
try:
|
||||||
kindlestrip.main((mobiPath + '_tostrip', mobiPath))
|
kindlestrip.main((mobiPath + '_tostrip', mobiPath))
|
||||||
except Exception:
|
except Exception:
|
||||||
errors = True
|
self.errors = True
|
||||||
continue
|
if not self.errors:
|
||||||
if not errors:
|
|
||||||
os.remove(mobiPath + '_tostrip')
|
os.remove(mobiPath + '_tostrip')
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Removing SRCS header... Done!', 'info', True)
|
self.emit(QtCore.SIGNAL("addMessage"), 'Removing SRCS header... Done!', 'info', True)
|
||||||
else:
|
else:
|
||||||
@@ -180,13 +177,15 @@ class WorkerThread(QtCore.QThread):
|
|||||||
os.remove(outputPath)
|
os.remove(outputPath)
|
||||||
os.remove(outputPath.replace('.epub', '.mobi'))
|
os.remove(outputPath.replace('.epub', '.mobi'))
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'KindleGen failed to create MOBI!', 'error')
|
self.emit(QtCore.SIGNAL("addMessage"), 'KindleGen failed to create MOBI!', 'error')
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Try converting smaller batch.', 'error')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Try converting a bit smaller batch.', 'error')
|
||||||
else:
|
else:
|
||||||
|
excess = (os.path.getsize(outputPath) - 314572800)/1024/1024
|
||||||
os.remove(outputPath)
|
os.remove(outputPath)
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Created EPUB file is too big for KindleGen!', 'error')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Created EPUB file is too big for KindleGen!', 'error')
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Try converting smaller batch.', 'error')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Limit exceeded by ' + str(excess) +
|
||||||
|
' MB. Try converting smaller batch.', 'error')
|
||||||
self.parent.needClean = True
|
self.parent.needClean = True
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'All jobs completed.', 'warning')
|
self.emit(QtCore.SIGNAL("addMessage"), 'All jobs completed.', 'info')
|
||||||
self.emit(QtCore.SIGNAL("modeConvert"), True)
|
self.emit(QtCore.SIGNAL("modeConvert"), True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user