From d0b72e1c837a77c9da3c46ff76bb5a95db9b7728 Mon Sep 17 00:00:00 2001 From: kiryl Date: Mon, 6 Oct 2025 15:53:45 +0200 Subject: [PATCH] Update Metadata Title checkbox behaviour - `Metadata Title` is now tristate checkbox, where metadata title is combined with generated title or used explicit or just ignored --- README.md | 2 +- gui/KCC.ui | 5 ++++- kindlecomicconverter/KCC_gui.py | 6 ++++-- kindlecomicconverter/KCC_ui.py | 5 +++-- kindlecomicconverter/comic2ebook.py | 9 ++++++--- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fd28e1d..ea60afd 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ OUTPUT SETTINGS: Output generated file to specified directory or file -t TITLE, --title TITLE Comic title [Default=filename or directory name] - --metadatatitle Write title from ComicInfo.xml or other embedded metadata + --metadatatitle Write title using ComicInfo.xml or other embedded metadata. 0: Don't use Title from metadata 1: Combine Title with default schema 2: Use Title only [Default=0] -a AUTHOR, --author AUTHOR Author name [Default=KCC] -f FORMAT, --format FORMAT diff --git a/gui/KCC.ui b/gui/KCC.ui index 202f65d..c95f3e9 100644 --- a/gui/KCC.ui +++ b/gui/KCC.ui @@ -593,11 +593,14 @@ - <html><head/><body><p>Write Title from ComicInfo.xml or other embedded metadata.</p></body></html> + <html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Unchecked - Don't use metadata Title<br/></span>Write default title.</p><p><span style=" font-weight:600; text-decoration: underline;">Indeterminate - Add metadata Title to the default schema<br/></span>Write default title with Title from ComicInfo.xml or other embedded metadata.</p><p><span style=" font-weight:600; text-decoration: underline;">Checked - Use metadata Title only<br/></span>Write Title from ComicInfo.xml or other embedded metadata.</p></body></html> Metadata Title + + true + diff --git a/kindlecomicconverter/KCC_gui.py b/kindlecomicconverter/KCC_gui.py index 717478a..a272244 100644 --- a/kindlecomicconverter/KCC_gui.py +++ b/kindlecomicconverter/KCC_gui.py @@ -321,8 +321,10 @@ class WorkerThread(QThread): options.maximizestrips = True if GUI.disableProcessingBox.isChecked(): options.noprocessing = True - if GUI.metadataTitleBox.isChecked(): - options.metadatatitle = True + if GUI.metadataTitleBox.checkState() == Qt.CheckState.PartiallyChecked: + options.metadatatitle = 1 + elif GUI.metadataTitleBox.checkState() == Qt.CheckState.Checked: + options.metadatatitle = 2 if GUI.deleteBox.isChecked(): options.delete = True if GUI.spreadShiftBox.isChecked(): diff --git a/kindlecomicconverter/KCC_ui.py b/kindlecomicconverter/KCC_ui.py index ba94511..26454a3 100644 --- a/kindlecomicconverter/KCC_ui.py +++ b/kindlecomicconverter/KCC_ui.py @@ -3,7 +3,7 @@ ################################################################################ ## Form generated from reading UI file 'KCC.ui' ## -## Created by: Qt User Interface Compiler version 6.9.1 +## Created by: Qt User Interface Compiler version 6.9.3 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ @@ -319,6 +319,7 @@ class Ui_mainWindow(object): self.metadataTitleBox = QCheckBox(self.optionWidget) self.metadataTitleBox.setObjectName(u"metadataTitleBox") + self.metadataTitleBox.setTristate(True) self.gridLayout_2.addWidget(self.metadataTitleBox, 7, 0, 1, 1) @@ -583,7 +584,7 @@ class Ui_mainWindow(object): #endif // QT_CONFIG(tooltip) self.outputSplit.setText(QCoreApplication.translate("mainWindow", u"Output split", None)) #if QT_CONFIG(tooltip) - self.metadataTitleBox.setToolTip(QCoreApplication.translate("mainWindow", u"

Write Title from ComicInfo.xml or other embedded metadata.

", None)) + self.metadataTitleBox.setToolTip(QCoreApplication.translate("mainWindow", u"

Unchecked - Don't use metadata Title
Write default title.

Indeterminate - Add metadata Title to the default schema
Write default title with Title from ComicInfo.xml or other embedded metadata.

Checked - Use metadata Title only
Write Title from ComicInfo.xml or other embedded metadata.

", None)) #endif // QT_CONFIG(tooltip) self.metadataTitleBox.setText(QCoreApplication.translate("mainWindow", u"Metadata Title", None)) #if QT_CONFIG(tooltip) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index b528676..662f09e 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -958,7 +958,7 @@ def getMetadata(path, originalpath): except Exception: os.remove(xmlPath) return - if options.metadatatitle: + if options.metadatatitle == 2: options.title = xml.data['Title'] elif defaultTitle: if xml.data['Series']: @@ -967,6 +967,8 @@ def getMetadata(path, originalpath): titleSuffix += ' Vol. ' + xml.data['Volume'].zfill(2) if xml.data['Number']: titleSuffix += ' #' + xml.data['Number'].zfill(3) + if options.metadatatitle == 1 and xml.data['Title']: + titleSuffix += ': ' + xml.data['Title'] options.title += titleSuffix if defaultAuthor: options.authors = [] @@ -1290,8 +1292,9 @@ def makeParser(): help="Output generated file to specified directory or file") output_options.add_argument("-t", "--title", action="store", dest="title", default="defaulttitle", help="Comic title [Default=filename or directory name]") - output_options.add_argument("--metadatatitle", action="store_true", dest="metadatatitle", default=False, - help="Write Title from ComicInfo.xml or other embedded metadata") + output_options.add_argument("--metadatatitle", type=int, dest="metadatatitle", default=0, + help="Write title using ComicInfo.xml or other embedded metadata. 1: Combine Title with default schema " + "2: Use Title only") output_options.add_argument("-a", "--author", action="store", dest="author", default="defaultauthor", help="Author name [Default=KCC]") output_options.add_argument("-f", "--format", action="store", dest="format", default="Auto",