From afc95fa943803419f77563146b520f59f826b9a0 Mon Sep 17 00:00:00 2001 From: Constantin Hong Date: Fri, 3 Mar 2023 06:21:00 +0900 Subject: [PATCH 1/3] gui/func: add delete button (closes ciromattia#458) --- kindlecomicconverter/KCC_gui.py | 14 ++++++++++++++ kindlecomicconverter/KCC_ui.py | 9 ++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index b38b962b..94cf1e64 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -294,6 +294,10 @@ def run(self): options.maximizestrips = True if GUI.disableProcessingBox.isChecked(): options.noprocessing = True + if GUI.deleteBox.checkState() == 1: + options.delete = 2 + elif GUI.deleteBox.checkState() == 2: + options.delete = 1 if GUI.mozJpegBox.checkState() == 1: options.forcepng = True elif GUI.mozJpegBox.checkState() == 2: @@ -638,6 +642,14 @@ def togglewebtoonBox(self, value): GUI.rotateBox.setEnabled(True) GUI.upscaleBox.setEnabled(True) + def toggledeleteBox(self, value): + if value: + GUI.deleteBox.setEnabled(False) + GUI.deleteBox.setChecked(False) + else: + GUI.deleteBox.setEnabled(True) + GUI.deleteBox.setChecked(True) + def togglequalityBox(self, value): profile = GUI.profiles[str(GUI.deviceBox.currentText())] if value == 2: @@ -823,6 +835,7 @@ def saveSettings(self, event): 'mozJpegBox': GUI.mozJpegBox.checkState(), 'widthBox': GUI.widthBox.value(), 'heightBox': GUI.heightBox.value(), + 'deleteBox': GUI.deleteBox.value(), 'maximizeStrips': GUI.maximizeStrips.checkState(), 'gammaSlider': float(self.gammaValue) * 100}) self.settings.sync() @@ -1085,6 +1098,7 @@ def __init__(self, kccapp, kccwindow): GUI.gammaSlider.valueChanged.connect(self.changeGamma) GUI.gammaBox.stateChanged.connect(self.togglegammaBox) GUI.croppingBox.stateChanged.connect(self.togglecroppingBox) + GUI.deleteBox.stateChanged.connect(self.toggledeleteBox) GUI.croppingPowerSlider.valueChanged.connect(self.changeCroppingPower) GUI.webtoonBox.stateChanged.connect(self.togglewebtoonBox) GUI.qualityBox.stateChanged.connect(self.togglequalityBox) diff --git a/kindlecomicconverter/KCC_ui.py b/kindlecomicconverter/KCC_ui.py index 66b2d173..801f7466 100644 --- a/kindlecomicconverter/KCC_ui.py +++ b/kindlecomicconverter/KCC_ui.py @@ -70,6 +70,10 @@ def setupUi(self, mainWindow): self.croppingBox.setTristate(True) self.croppingBox.setObjectName("croppingBox") self.gridLayout_2.addWidget(self.croppingBox, 3, 2, 1, 1) + self.deleteBox = QtWidgets.QCheckBox(self.optionWidget) + self.deleteBox.setTristate(True) + self.deleteBox.setObjectName("delete Bod") + self.gridLayout_2.addWidget(self.deleteBox, 5, 2, 1, 1) self.disableProcessingBox = QtWidgets.QCheckBox(self.optionWidget) self.disableProcessingBox.setObjectName("disableProcessingBox") self.gridLayout_2.addWidget(self.disableProcessingBox, 4, 2, 1, 1) @@ -252,7 +256,8 @@ def setupUi(self, mainWindow): mainWindow.setTabOrder(self.borderBox, self.outputSplit) mainWindow.setTabOrder(self.outputSplit, self.colorBox) mainWindow.setTabOrder(self.colorBox, self.croppingBox) - mainWindow.setTabOrder(self.croppingBox, self.mozJpegBox) + mainWindow.setTabOrder(self.croppingBox, self.deleteBox) + mainWindow.setTabOrder(self.deleteBox, self.mozJpegBox) mainWindow.setTabOrder(self.mozJpegBox, self.maximizeStrips) mainWindow.setTabOrder(self.maximizeStrips, self.disableProcessingBox) mainWindow.setTabOrder(self.disableProcessingBox, self.editorButton) @@ -290,6 +295,8 @@ def retranslateUi(self, mainWindow): self.maximizeStrips.setText(_translate("mainWindow", "1x4 to 2x2 strips")) self.croppingBox.setToolTip(_translate("mainWindow", "

Unchecked - Disabled

Disabled

Indeterminate - Margins
Margins

Checked - Margins + page numbers
Margins +page numbers

")) self.croppingBox.setText(_translate("mainWindow", "Cropping mode")) + self.deleteBox.setToolTip(_translate("mainWindow", "

Unchecked - Disabled

Disabled

Indeterminate - Margins
Margins

Checked - Margins + page numbers
Margins +page numbers

")) + self.deleteBox.setText(_translate("mainWindow", "Delete after conversion")) self.disableProcessingBox.setToolTip(_translate("mainWindow", "

Do not process any image, ignore profil and processing options

")) self.disableProcessingBox.setText(_translate("mainWindow", "Disable processing")) self.gammaLabel.setText(_translate("mainWindow", "Gamma: Auto")) From 8e7edb83b5891699ccc1e4a08d2a54758bbefef7 Mon Sep 17 00:00:00 2001 From: Constantin Hong <61624808+Constantin1489@users.noreply.github.com> Date: Fri, 3 Mar 2023 06:40:54 +0900 Subject: [PATCH 2/3] Update KCC_ui.py fix typo --- kindlecomicconverter/KCC_ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kindlecomicconverter/KCC_ui.py b/kindlecomicconverter/KCC_ui.py index 801f7466..34a4b6f8 100644 --- a/kindlecomicconverter/KCC_ui.py +++ b/kindlecomicconverter/KCC_ui.py @@ -72,7 +72,7 @@ def setupUi(self, mainWindow): self.gridLayout_2.addWidget(self.croppingBox, 3, 2, 1, 1) self.deleteBox = QtWidgets.QCheckBox(self.optionWidget) self.deleteBox.setTristate(True) - self.deleteBox.setObjectName("delete Bod") + self.deleteBox.setObjectName("delete Box") self.gridLayout_2.addWidget(self.deleteBox, 5, 2, 1, 1) self.disableProcessingBox = QtWidgets.QCheckBox(self.optionWidget) self.disableProcessingBox.setObjectName("disableProcessingBox") From 1737459a7a79a14423d8fabf44df8311734ab52d Mon Sep 17 00:00:00 2001 From: darodi <4682830+darodi@users.noreply.github.com> Date: Thu, 2 Mar 2023 23:10:39 +0100 Subject: [PATCH 3/3] GUI delete option checkBox --- gui/KCC.ui | 15 +++++++++++++-- kindlecomicconverter/KCC_gui.py | 15 ++------------- kindlecomicconverter/KCC_ui.py | 19 +++++++++---------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/gui/KCC.ui b/gui/KCC.ui index afc934d8..bcc1d20f 100644 --- a/gui/KCC.ui +++ b/gui/KCC.ui @@ -175,10 +175,20 @@ + + + + Delete input file(s) or directory. It's not recoverable! + + + Delete input + + + - <html><head/><body><p style='white-space:pre'>Do not process any image, ignore profil and processing options</p></body></html> + <html><head/><body><pre style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Do not process any image, ignore profile and processing options</pre></body></html> Disable processing @@ -257,7 +267,7 @@ - 10 + 200 1 @@ -600,6 +610,7 @@ croppingBox mozJpegBox maximizeStrips + deleteBox disableProcessingBox editorButton wikiButton diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index 94cf1e64..92c35a4f 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -294,10 +294,8 @@ def run(self): options.maximizestrips = True if GUI.disableProcessingBox.isChecked(): options.noprocessing = True - if GUI.deleteBox.checkState() == 1: - options.delete = 2 - elif GUI.deleteBox.checkState() == 2: - options.delete = 1 + if GUI.deleteBox.isChecked(): + options.delete = True if GUI.mozJpegBox.checkState() == 1: options.forcepng = True elif GUI.mozJpegBox.checkState() == 2: @@ -642,14 +640,6 @@ def togglewebtoonBox(self, value): GUI.rotateBox.setEnabled(True) GUI.upscaleBox.setEnabled(True) - def toggledeleteBox(self, value): - if value: - GUI.deleteBox.setEnabled(False) - GUI.deleteBox.setChecked(False) - else: - GUI.deleteBox.setEnabled(True) - GUI.deleteBox.setChecked(True) - def togglequalityBox(self, value): profile = GUI.profiles[str(GUI.deviceBox.currentText())] if value == 2: @@ -1098,7 +1088,6 @@ def __init__(self, kccapp, kccwindow): GUI.gammaSlider.valueChanged.connect(self.changeGamma) GUI.gammaBox.stateChanged.connect(self.togglegammaBox) GUI.croppingBox.stateChanged.connect(self.togglecroppingBox) - GUI.deleteBox.stateChanged.connect(self.toggledeleteBox) GUI.croppingPowerSlider.valueChanged.connect(self.changeCroppingPower) GUI.webtoonBox.stateChanged.connect(self.togglewebtoonBox) GUI.qualityBox.stateChanged.connect(self.togglequalityBox) diff --git a/kindlecomicconverter/KCC_ui.py b/kindlecomicconverter/KCC_ui.py index 34a4b6f8..0db83b0c 100644 --- a/kindlecomicconverter/KCC_ui.py +++ b/kindlecomicconverter/KCC_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'gui/KCC.ui' # -# Created by: PyQt5 UI code generator 5.15.6 +# Created by: PyQt5 UI code generator 5.15.7 # # 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. @@ -71,9 +71,8 @@ def setupUi(self, mainWindow): self.croppingBox.setObjectName("croppingBox") self.gridLayout_2.addWidget(self.croppingBox, 3, 2, 1, 1) self.deleteBox = QtWidgets.QCheckBox(self.optionWidget) - self.deleteBox.setTristate(True) - self.deleteBox.setObjectName("delete Box") - self.gridLayout_2.addWidget(self.deleteBox, 5, 2, 1, 1) + self.deleteBox.setObjectName("deleteBox") + self.gridLayout_2.addWidget(self.deleteBox, 4, 1, 1, 1) self.disableProcessingBox = QtWidgets.QCheckBox(self.optionWidget) self.disableProcessingBox.setObjectName("disableProcessingBox") self.gridLayout_2.addWidget(self.disableProcessingBox, 4, 2, 1, 1) @@ -256,10 +255,10 @@ def setupUi(self, mainWindow): mainWindow.setTabOrder(self.borderBox, self.outputSplit) mainWindow.setTabOrder(self.outputSplit, self.colorBox) mainWindow.setTabOrder(self.colorBox, self.croppingBox) - mainWindow.setTabOrder(self.croppingBox, self.deleteBox) - mainWindow.setTabOrder(self.deleteBox, self.mozJpegBox) + mainWindow.setTabOrder(self.croppingBox, self.mozJpegBox) mainWindow.setTabOrder(self.mozJpegBox, self.maximizeStrips) - mainWindow.setTabOrder(self.maximizeStrips, self.disableProcessingBox) + mainWindow.setTabOrder(self.maximizeStrips, self.deleteBox) + mainWindow.setTabOrder(self.deleteBox, self.disableProcessingBox) mainWindow.setTabOrder(self.disableProcessingBox, self.editorButton) mainWindow.setTabOrder(self.editorButton, self.wikiButton) mainWindow.setTabOrder(self.wikiButton, self.jobList) @@ -295,9 +294,9 @@ def retranslateUi(self, mainWindow): self.maximizeStrips.setText(_translate("mainWindow", "1x4 to 2x2 strips")) self.croppingBox.setToolTip(_translate("mainWindow", "

Unchecked - Disabled

Disabled

Indeterminate - Margins
Margins

Checked - Margins + page numbers
Margins +page numbers

")) self.croppingBox.setText(_translate("mainWindow", "Cropping mode")) - self.deleteBox.setToolTip(_translate("mainWindow", "

Unchecked - Disabled

Disabled

Indeterminate - Margins
Margins

Checked - Margins + page numbers
Margins +page numbers

")) - self.deleteBox.setText(_translate("mainWindow", "Delete after conversion")) - self.disableProcessingBox.setToolTip(_translate("mainWindow", "

Do not process any image, ignore profil and processing options

")) + self.deleteBox.setToolTip(_translate("mainWindow", "Delete input file(s) or directory. It\'s not recoverable!")) + self.deleteBox.setText(_translate("mainWindow", "Delete input")) + self.disableProcessingBox.setToolTip(_translate("mainWindow", "
Do not process any image, ignore profile and processing options
")) self.disableProcessingBox.setText(_translate("mainWindow", "Disable processing")) self.gammaLabel.setText(_translate("mainWindow", "Gamma: Auto")) self.croppingPowerLabel.setText(_translate("mainWindow", "Cropping power:"))