Improved cleanup (close #58)

This commit is contained in:
Paweł Jastrzębski
2013-08-15 10:05:03 +02:00
parent 6b002a8475
commit e32018e8f6
3 changed files with 16 additions and 7 deletions
+12 -3
View File
@@ -228,8 +228,10 @@ class WorkerThread(QtCore.QThread):
continue
if not self.conversionAlive:
for item in outputPath:
os.remove(item)
os.remove(item.replace('.epub', '.mobi'))
if os.path.exists(item):
os.remove(item)
if os.path.exists(item.replace('.epub', '.mobi')):
os.remove(item.replace('.epub', '.mobi'))
self.clean()
return
if self.kindlegenErrorCode == 0:
@@ -532,8 +534,15 @@ class Ui_KCC(object):
def hideProgressBar(self):
GUI.ProgressBar.hide()
# noinspection PyUnusedLocal
def saveSettings(self, event):
if self.conversionAlive:
GUI.ConvertButton.setEnabled(False)
self.addMessage('Process will be interrupted. Please wait.', 'warning')
self.conversionAlive = False
self.worker.sync()
event.ignore()
if not GUI.ConvertButton.isEnabled():
event.ignore()
self.settings.setValue('lastPath', self.lastPath)
self.settings.setValue('lastDevice', GUI.DeviceBox.currentIndex())
self.settings.setValue('currentFormat', GUI.FormatBox.currentIndex())