Add: some code styling

This commit is contained in:
Gabès Jean 2015-10-07 21:50:47 +02:00
parent 1608f10fbd
commit 83251909b3
4 changed files with 41 additions and 35 deletions

View File

@ -16,10 +16,10 @@
import os
import shutil
from PyQt4 import QtGui, QtCore
from image import ImageFlags
from image import ImageFlags
import cbz
import image
import pdfimage
@ -121,7 +121,6 @@ class DialogConvert(QtGui.QProgressDialog):
archive = self.archive
pdf = self.pdf
# Maybe the user ask for a split, but the picture is not a large one, so skip
# it but only for this picture
if (flags & ImageFlags.Split) or (flags & ImageFlags.SplitInverse):
@ -132,7 +131,7 @@ class DialogConvert(QtGui.QProgressDialog):
flags &= ~f
# For right page (if requested in options and need for this image)
if(flags & ImageFlags.Split):
if (flags & ImageFlags.Split):
# New path based on modified index
target = os.path.join(self.bookPath, '%05d.png' % (index * 2 + 0))
self.convertAndSave(source, target, device, flags ^ ImageFlags.Split | ImageFlags.SplitRight, archive, pdf)
@ -140,7 +139,7 @@ class DialogConvert(QtGui.QProgressDialog):
target = os.path.join(self.bookPath, '%05d.png' % (index * 2 + 1))
# For right page (if requested), but in inverted mode
if(flags & ImageFlags.SplitInverse):
if (flags & ImageFlags.SplitInverse):
# New path based on modified index
target = os.path.join(self.bookPath, '%05d.png' % (index * 2 + 0))
self.convertAndSave(source, target, device, flags ^ ImageFlags.SplitInverse | ImageFlags.SplitLeft, archive, pdf)

View File

@ -35,6 +35,7 @@ class DialogOptions(QtGui.QDialog):
self.moveDialogToOptions()
# Get options from current book (like a loaded one) and set the dialog values
def moveOptionsToDialog(self):
self.lineEditTitle.setText(self.book.title or 'Untitled')
self.comboBoxDevice.setCurrentIndex(max(self.comboBoxDevice.findText(self.book.device), 0))
@ -47,12 +48,15 @@ class DialogOptions(QtGui.QDialog):
self.checkboxFrame.setChecked(self.book.imageFlags & ImageFlags.Frame)
# Save parameters set on the dialogs to the book object if need
def moveDialogToOptions(self):
# First get dialog values
title = self.lineEditTitle.text()
device = self.comboBoxDevice.currentText()
outputFormat = self.comboBoxFormat.currentText()
overwrite = self.checkboxOverwrite.isChecked()
# Now compute flags
imageFlags = 0
if self.checkboxOrient.isChecked():
imageFlags |= ImageFlags.Orient
@ -69,6 +73,9 @@ class DialogOptions(QtGui.QDialog):
if self.checkboxSplitInverse.isChecked():
imageFlags |= ImageFlags.SplitInverse
# If we did modified a value, update the book
# and only if we did change something to not
# warn for nothing the user
modified = (
self.book.title != title or
self.book.device != device or