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:
|
||||
self.errors = True
|
||||
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:
|
||||
self.errors = True
|
||||
type_, value_, traceback_ = sys.exc_info()
|
||||
self.emit(QtCore.SIGNAL("showDialog"), "Error during conversion %s:\n\n%s\n\nTraceback:\n%s"
|
||||
% (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:
|
||||
for item in outputPath:
|
||||
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)
|
||||
if str(GUI.FormatBox.currentText()) == 'MOBI':
|
||||
tomeNumber = 0
|
||||
self.emit(QtCore.SIGNAL("progressBarTick"), 'status', 'Creating MOBI files')
|
||||
self.emit(QtCore.SIGNAL("progressBarTick"), len(outputPath)*2)
|
||||
for item in outputPath:
|
||||
tomeNumber += 1
|
||||
if len(outputPath) > 1:
|
||||
@@ -214,7 +216,7 @@ class WorkerThread(QtCore.QThread):
|
||||
+ '/' + str(len(outputPath)) + ')...', 'info')
|
||||
else:
|
||||
self.emit(QtCore.SIGNAL("addMessage"), 'Creating MOBI file...', 'info')
|
||||
self.emit(QtCore.SIGNAL("progressBarTick"), 1)
|
||||
self.emit(QtCore.SIGNAL("progressBarTick"))
|
||||
try:
|
||||
self.kindlegenErrorCode = 0
|
||||
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',
|
||||
True)
|
||||
self.emit(QtCore.SIGNAL("addMessage"), 'Cleaning MOBI file...', 'info')
|
||||
self.emit(QtCore.SIGNAL("progressBarTick"))
|
||||
os.remove(item)
|
||||
mobiPath = item.replace('.epub', '.mobi')
|
||||
shutil.move(mobiPath, mobiPath + '_toclean')
|
||||
|
||||
@@ -875,7 +875,15 @@ def main(argv=None, qtGUI=None):
|
||||
tomes = [path]
|
||||
filepath = []
|
||||
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:
|
||||
if GUI:
|
||||
GUI.emit(QtCore.SIGNAL("progressBarTick"))
|
||||
if os.path.isdir(args[0]):
|
||||
barePath = os.path.basename(args[0])
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user