mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 09:46:25 +00:00
Added progressbar support in few places
This commit is contained in:
@@ -187,13 +187,13 @@ class WorkerThread(QtCore.QThread):
|
|||||||
else:
|
else:
|
||||||
self.errors = True
|
self.errors = True
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), str(warn), 'warning')
|
self.emit(QtCore.SIGNAL("addMessage"), str(warn), 'warning')
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'KCC failed to create output file!', 'warning')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Failed to create output file!', 'warning')
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.errors = True
|
self.errors = True
|
||||||
type_, value_, traceback_ = sys.exc_info()
|
type_, value_, traceback_ = sys.exc_info()
|
||||||
self.emit(QtCore.SIGNAL("showDialog"), "Error during conversion %s:\n\n%s\n\nTraceback:\n%s"
|
self.emit(QtCore.SIGNAL("showDialog"), "Error during conversion %s:\n\n%s\n\nTraceback:\n%s"
|
||||||
% (jobargv[-1], str(err), traceback.format_tb(traceback_)))
|
% (jobargv[-1], str(err), traceback.format_tb(traceback_)))
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'KCC failed to create EPUB!', 'error')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Failed to create EPUB!', 'error')
|
||||||
if not self.conversionAlive:
|
if not self.conversionAlive:
|
||||||
for item in outputPath:
|
for item in outputPath:
|
||||||
if os.path.exists(item):
|
if os.path.exists(item):
|
||||||
@@ -207,6 +207,8 @@ class WorkerThread(QtCore.QThread):
|
|||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Creating EPUB file... <b>Done!</b>', 'info', True)
|
self.emit(QtCore.SIGNAL("addMessage"), 'Creating EPUB file... <b>Done!</b>', 'info', True)
|
||||||
if str(GUI.FormatBox.currentText()) == 'MOBI':
|
if str(GUI.FormatBox.currentText()) == 'MOBI':
|
||||||
tomeNumber = 0
|
tomeNumber = 0
|
||||||
|
self.emit(QtCore.SIGNAL("progressBarTick"), 'status', 'Creating MOBI files')
|
||||||
|
self.emit(QtCore.SIGNAL("progressBarTick"), len(outputPath)*2)
|
||||||
for item in outputPath:
|
for item in outputPath:
|
||||||
tomeNumber += 1
|
tomeNumber += 1
|
||||||
if len(outputPath) > 1:
|
if len(outputPath) > 1:
|
||||||
@@ -214,7 +216,7 @@ class WorkerThread(QtCore.QThread):
|
|||||||
+ '/' + str(len(outputPath)) + ')...', 'info')
|
+ '/' + str(len(outputPath)) + ')...', 'info')
|
||||||
else:
|
else:
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Creating MOBI file...', 'info')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Creating MOBI file...', 'info')
|
||||||
self.emit(QtCore.SIGNAL("progressBarTick"), 1)
|
self.emit(QtCore.SIGNAL("progressBarTick"))
|
||||||
try:
|
try:
|
||||||
self.kindlegenErrorCode = 0
|
self.kindlegenErrorCode = 0
|
||||||
if os.path.getsize(item) < 367001600:
|
if os.path.getsize(item) < 367001600:
|
||||||
@@ -254,6 +256,7 @@ class WorkerThread(QtCore.QThread):
|
|||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Creating MOBI file... <b>Done!</b>', 'info',
|
self.emit(QtCore.SIGNAL("addMessage"), 'Creating MOBI file... <b>Done!</b>', 'info',
|
||||||
True)
|
True)
|
||||||
self.emit(QtCore.SIGNAL("addMessage"), 'Cleaning MOBI file...', 'info')
|
self.emit(QtCore.SIGNAL("addMessage"), 'Cleaning MOBI file...', 'info')
|
||||||
|
self.emit(QtCore.SIGNAL("progressBarTick"))
|
||||||
os.remove(item)
|
os.remove(item)
|
||||||
mobiPath = item.replace('.epub', '.mobi')
|
mobiPath = item.replace('.epub', '.mobi')
|
||||||
shutil.move(mobiPath, mobiPath + '_toclean')
|
shutil.move(mobiPath, mobiPath + '_toclean')
|
||||||
|
|||||||
@@ -875,7 +875,15 @@ def main(argv=None, qtGUI=None):
|
|||||||
tomes = [path]
|
tomes = [path]
|
||||||
filepath = []
|
filepath = []
|
||||||
tomeNumber = 0
|
tomeNumber = 0
|
||||||
|
if GUI:
|
||||||
|
if options.cbzoutput:
|
||||||
|
GUI.emit(QtCore.SIGNAL("progressBarTick"), 'status', 'Compressing CBZ files')
|
||||||
|
else:
|
||||||
|
GUI.emit(QtCore.SIGNAL("progressBarTick"), 'status', 'Compressing EPUB files')
|
||||||
|
GUI.emit(QtCore.SIGNAL("progressBarTick"), len(tomes))
|
||||||
for tome in tomes:
|
for tome in tomes:
|
||||||
|
if GUI:
|
||||||
|
GUI.emit(QtCore.SIGNAL("progressBarTick"))
|
||||||
if os.path.isdir(args[0]):
|
if os.path.isdir(args[0]):
|
||||||
barePath = os.path.basename(args[0])
|
barePath = os.path.basename(args[0])
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user