Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable all image transformation : cli and GUI option #388

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions gen_ui_files.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

REM install qt creator
REM conda create -n qtenv python=3.7
REM conda activate qtenv
REM pip install PyQt5

pyuic5 gui/KCC.ui > kindlecomicconverter/KCC_ui.py

pyuic5 gui/MetaEditor.ui > kindlecomicconverter/KCC_ui_editor.py

pyrcc5 gui/KCC.qrc > kindlecomicconverter/KCC_rc.py
10 changes: 10 additions & 0 deletions gen_ui_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# PREPARE PYTHON ENV
# conda create -n pyqt5 python=3.7
# source activate pyqt5
# pip install pyqt5

pyuic5 gui/KCC.ui --from-imports > kindlecomicconverter/KCC_ui.py
pyuic5 gui/MetaEditor.ui --from-imports > kindlecomicconverter/KCC_ui_editor.py
pyrcc5 gui/KCC.qrc > kindlecomicconverter/KCC_rc.py
396 changes: 203 additions & 193 deletions gui/KCC.ui

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions kindlecomicconverter/KCC_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ def run(self):
options.batchsplit = 2
if GUI.colorBox.isChecked():
options.forcecolor = True
if GUI.disableProcessingBox.isChecked():
options.noprocessing = True
if GUI.currentMode > 2:
options.customwidth = str(GUI.widthBox.value())
options.customheight = str(GUI.heightBox.value())
Expand Down Expand Up @@ -783,6 +785,7 @@ def saveSettings(self, event):
'webtoonBox': GUI.webtoonBox.checkState(),
'outputSplit': GUI.outputSplit.checkState(),
'colorBox': GUI.colorBox.checkState(),
'disableProcessingBox': GUI.disableProcessingBox.checkState(),
'widthBox': GUI.widthBox.value(),
'heightBox': GUI.heightBox.value(),
'gammaSlider': float(self.gammaValue) * 100})
Expand Down
12,407 changes: 6,237 additions & 6,170 deletions kindlecomicconverter/KCC_rc.py

Large diffs are not rendered by default.

251 changes: 129 additions & 122 deletions kindlecomicconverter/KCC_ui.py

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions kindlecomicconverter/KCC_ui_editor.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'gui\MetaEditor.ui'
# Form implementation generated from reading ui file 'gui/MetaEditor.ui'
#
# Created by: PyQt5 UI code generator 5.6
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING! All changes made in this file will be lost!
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_editorDialog(object):
def setupUi(self, editorDialog):
editorDialog.setObjectName("editorDialog")
Expand Down Expand Up @@ -112,5 +115,4 @@ def retranslateUi(self, editorDialog):
self.label_7.setText(_translate("editorDialog", "Colorist:"))
self.okButton.setText(_translate("editorDialog", "Save"))
self.cancelButton.setText(_translate("editorDialog", "Cancel"))

from . import KCC_rc
13 changes: 9 additions & 4 deletions kindlecomicconverter/comic2ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,8 @@ def makeParser():
help="Split output into multiple files. 0: Don't split 1: Automatic mode "
"2: Consider every subdirectory as separate volume [Default=0]")

processingOptions.add_option("-n", "--noprocessing", action="store_true", dest="noprocessing", default=False,
help="Do not modify image and ignore any profil or processing option")
processingOptions.add_option("-u", "--upscale", action="store_true", dest="upscale", default=False,
help="Resize images smaller than device's resolution")
processingOptions.add_option("-s", "--stretch", action="store_true", dest="stretch", default=False,
Expand Down Expand Up @@ -1083,10 +1085,13 @@ def makeBook(source, qtgui=None):
else:
y = image.ProfileData.Profiles[options.profile][1][1]
comic2panel.main(['-y ' + str(y), '-i', '-m', path], qtgui)
print("Processing images...")
if GUI:
GUI.progressBarTick.emit('Processing images')
imgDirectoryProcessing(os.path.join(path, "OEBPS", "Images"))
if options.noprocessing:
print("Do not process image, ignore any profil or processing option")
else:
print("Processing images...")
if GUI:
GUI.progressBarTick.emit('Processing images')
imgDirectoryProcessing(os.path.join(path, "OEBPS", "Images"))
if GUI:
GUI.progressBarTick.emit('1')
chapterNames = sanitizeTree(os.path.join(path, 'OEBPS', 'Images'))
Expand Down