Made CBZ-only format work properly
This commit is contained in:
parent
ee8d8ddef7
commit
fa5c378cb8
@ -13,7 +13,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os, shutil
|
||||||
|
|
||||||
from PyQt4 import QtGui, QtCore
|
from PyQt4 import QtGui, QtCore
|
||||||
|
|
||||||
import image
|
import image
|
||||||
@ -23,7 +24,6 @@ import cbz
|
|||||||
class DialogConvert(QtGui.QProgressDialog):
|
class DialogConvert(QtGui.QProgressDialog):
|
||||||
def __init__(self, parent, book, directory):
|
def __init__(self, parent, book, directory):
|
||||||
QtGui.QProgressDialog.__init__(self)
|
QtGui.QProgressDialog.__init__(self)
|
||||||
#self.setAutoReset(False)
|
|
||||||
|
|
||||||
self.book = book
|
self.book = book
|
||||||
self.directory = directory
|
self.directory = directory
|
||||||
@ -47,10 +47,15 @@ class DialogConvert(QtGui.QProgressDialog):
|
|||||||
self.timer.start(0)
|
self.timer.start(0)
|
||||||
|
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def hideEvent(self, event):
|
||||||
print "closeEvent"
|
"""Called when the dialog finishes processing."""
|
||||||
self.closing.emit()
|
# close the archive if we created a CBZ file
|
||||||
event.accept()
|
if self.archive is not None:
|
||||||
|
self.archive.close()
|
||||||
|
# remove image directory if the user didn't wish for images
|
||||||
|
if 'image' not in self.book.outputFormat:
|
||||||
|
path = os.path.join(unicode(self.directory), unicode(self.book.title))
|
||||||
|
shutil.rmtree(path)
|
||||||
|
|
||||||
def onTimer(self):
|
def onTimer(self):
|
||||||
index = self.value()
|
index = self.value()
|
||||||
|
@ -25,6 +25,8 @@ class DialogOptions(QtGui.QDialog):
|
|||||||
def __init__(self, parent, book):
|
def __init__(self, parent, book):
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.book = book
|
self.book = book
|
||||||
|
self.formats = {'image+cbz' : 0, 'image' : 1, 'cbz' : 2}
|
||||||
|
self.reverse_formats = dict((v,k) for k, v in self.formats.iteritems())
|
||||||
ui = uic.loadUi(os.path.join(resources.get_ui_path(), 'options.ui'), self)
|
ui = uic.loadUi(os.path.join(resources.get_ui_path(), 'options.ui'), self)
|
||||||
self.connect(self, QtCore.SIGNAL('accepted()'), self.onAccept)
|
self.connect(self, QtCore.SIGNAL('accepted()'), self.onAccept)
|
||||||
self.moveOptionsToDialog()
|
self.moveOptionsToDialog()
|
||||||
@ -37,8 +39,7 @@ class DialogOptions(QtGui.QDialog):
|
|||||||
def moveOptionsToDialog(self):
|
def moveOptionsToDialog(self):
|
||||||
self.lineEditTitle.setText(self.book.title or 'Untitled')
|
self.lineEditTitle.setText(self.book.title or 'Untitled')
|
||||||
self.comboBoxDevice.setCurrentIndex(max(self.comboBoxDevice.findText(self.book.device), 0))
|
self.comboBoxDevice.setCurrentIndex(max(self.comboBoxDevice.findText(self.book.device), 0))
|
||||||
formats = {'image+cbz' : 0, 'image' : 1, 'cbz' : 2}
|
self.comboBoxFormat.setCurrentIndex(self.formats.get(self.book.outputFormat, self.formats['image+cbz']))
|
||||||
self.comboBoxFormat.setCurrentIndex(formats.get(self.book.outputFormat, formats['image+cbz']))
|
|
||||||
self.checkboxOverwrite.setChecked(self.book.overwrite)
|
self.checkboxOverwrite.setChecked(self.book.overwrite)
|
||||||
self.checkboxOrient.setChecked(self.book.imageFlags & ImageFlags.Orient)
|
self.checkboxOrient.setChecked(self.book.imageFlags & ImageFlags.Orient)
|
||||||
self.checkboxResize.setChecked(self.book.imageFlags & ImageFlags.Resize)
|
self.checkboxResize.setChecked(self.book.imageFlags & ImageFlags.Resize)
|
||||||
@ -49,6 +50,7 @@ class DialogOptions(QtGui.QDialog):
|
|||||||
def moveDialogToOptions(self):
|
def moveDialogToOptions(self):
|
||||||
title = self.lineEditTitle.text()
|
title = self.lineEditTitle.text()
|
||||||
device = self.comboBoxDevice.itemText(self.comboBoxDevice.currentIndex())
|
device = self.comboBoxDevice.itemText(self.comboBoxDevice.currentIndex())
|
||||||
|
outputFormat = self.reverse_formats[self.comboBoxFormat.currentIndex()]
|
||||||
overwrite = self.checkboxOverwrite.isChecked()
|
overwrite = self.checkboxOverwrite.isChecked()
|
||||||
|
|
||||||
imageFlags = 0
|
imageFlags = 0
|
||||||
@ -65,7 +67,8 @@ class DialogOptions(QtGui.QDialog):
|
|||||||
self.book.title != title or
|
self.book.title != title or
|
||||||
self.book.device != device or
|
self.book.device != device or
|
||||||
self.book.overwrite != overwrite or
|
self.book.overwrite != overwrite or
|
||||||
self.book.imageFlags != imageFlags
|
self.book.imageFlags != imageFlags or
|
||||||
|
self.book.outputFormat != outputFormat
|
||||||
)
|
)
|
||||||
|
|
||||||
if modified:
|
if modified:
|
||||||
@ -74,3 +77,4 @@ class DialogOptions(QtGui.QDialog):
|
|||||||
self.book.device = device
|
self.book.device = device
|
||||||
self.book.overwrite = overwrite
|
self.book.overwrite = overwrite
|
||||||
self.book.imageFlags = imageFlags
|
self.book.imageFlags = imageFlags
|
||||||
|
self.book.outputFormat = outputFormat
|
||||||
|
Loading…
Reference in New Issue
Block a user