title changes filename and is enumerated in gui (#1507)

* title changes filename and is enumerated in gui

* ui changes
This commit is contained in:
Alex Xu authored and GitHub committed 2026-11-07 18:56:45 -08:00
1 parent 4e619fd1cc
commit 792e795808
6 files changed
+56 -67

No files matched your search

+4 -2
View File
@@ -915,10 +915,12 @@ Higher values are larger and higher quality, and may resolve blank page issues.<
<enum>Qt::FocusPolicy::ClickFocus</enum> <enum>Qt::FocusPolicy::ClickFocus</enum>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Default Title&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>For one item/fusion, sets the default title and filename.
For multiple files, will enumerate the titles and filenames, e.g. Series 01, Series 02, etc.</string>
</property> </property>
<property name="placeholderText"> <property name="placeholderText">
<string>Default Title</string> <string>Default Title/Series</string>
</property> </property>
<property name="clearButtonEnabled"> <property name="clearButtonEnabled">
<bool>false</bool> <bool>false</bool>
+2 -5
View File
@@ -466,11 +466,6 @@ class WorkerThread(QThread):
except Exception as e: except Exception as e:
print('Fusion Failed. ' + str(e)) print('Fusion Failed. ' + str(e))
MW.addMessage.emit(i18n.tr_arg(QCoreApplication.translate('KCCGUI', 'Fusion Failed. %1'), str(e)), 'error', True) MW.addMessage.emit(i18n.tr_arg(QCoreApplication.translate('KCCGUI', 'Fusion Failed. %1'), str(e)), 'error', True)
elif len(currentJobs) > 1 and options.title != 'defaulttitle':
currentJobs.clear()
error_message = QCoreApplication.translate('KCCGUI', 'Process Failed. Custom title can\'t be set when processing more than 1 source.\nDid you forget to check fusion?')
print(error_message)
MW.addMessage.emit(error_message, 'error', True)
for i, job in enumerate(currentJobs, start=1): for i, job in enumerate(currentJobs, start=1):
job_progress_number = f'[{i}/{len(currentJobs)}] ' job_progress_number = f'[{i}/{len(currentJobs)}] '
sleep(0.5) sleep(0.5)
@@ -495,6 +490,8 @@ class WorkerThread(QThread):
jobargv.append(job) jobargv.append(job)
try: try:
comic2ebook.options = comic2ebook.checkOptions(copy(options)) comic2ebook.options = comic2ebook.checkOptions(copy(options))
if len(currentJobs) > 1 and comic2ebook.options.title != 'defaulttitle':
comic2ebook.options.title += f' {i:0{len(str(len(currentJobs)))}}'
outputPath = comic2ebook.makeBook(job, fusion_cover_path, self, job_progress_number) outputPath = comic2ebook.makeBook(job, fusion_cover_path, self, job_progress_number)
MW.hideProgressBar.emit() MW.hideProgressBar.emit()
except UserWarning as warn: except UserWarning as warn:
+28 -28
View File
@@ -1,6 +1,6 @@
# Resource object code (Python 3) # Resource object code (Python 3)
# Created by: object code # Created by: object code
# Created by: The Resource Compiler for Qt version 6.9.3 # Created by: The Resource Compiler for Qt version 6.12.0
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
from PySide6 import QtCore from PySide6 import QtCore
@@ -25270,69 +25270,69 @@ qt_resource_struct = b"\
\x00\x00\x00v\x00\x02\x00\x00\x00\x04\x00\x00\x00\x09\ \x00\x00\x00v\x00\x02\x00\x00\x00\x04\x00\x00\x00\x09\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x02\xe2\x00\x00\x00\x00\x00\x01\x00\x05\x80\xb4\ \x00\x00\x02\xe2\x00\x00\x00\x00\x00\x01\x00\x05\x80\xb4\
\x00\x00\x01\xa0\xf7.\x05\xa1\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x03 \x00\x00\x00\x00\x00\x01\x00\x05\xd5N\ \x00\x00\x03 \x00\x00\x00\x00\x00\x01\x00\x05\xd5N\
\x00\x00\x01\xa0\xf7.\x05\x9f\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x03\x0c\x00\x00\x00\x00\x00\x01\x00\x05\xabS\ \x00\x00\x03\x0c\x00\x00\x00\x00\x00\x01\x00\x05\xabS\
\x00\x00\x01\xa0\xf7.\x05\x9f\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x02\xf8\x00\x00\x00\x00\x00\x01\x00\x05\x9f\xf0\ \x00\x00\x02\xf8\x00\x00\x00\x00\x00\x01\x00\x05\x9f\xf0\
\x00\x00\x01\xa0\xf7.\x05\x9f\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x00v\x00\x02\x00\x00\x00\x04\x00\x00\x00\x0e\ \x00\x00\x00v\x00\x02\x00\x00\x00\x04\x00\x00\x00\x0e\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x01\xc8\x00\x00\x00\x00\x00\x01\x00\x04z^\ \x00\x00\x01\xc8\x00\x00\x00\x00\x00\x01\x00\x04z^\
\x00\x00\x01\xa0\xf7.\x05\xa0\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x01\xde\x00\x00\x00\x00\x00\x01\x00\x04\x83\xb6\ \x00\x00\x01\xde\x00\x00\x00\x00\x00\x01\x00\x04\x83\xb6\
\x00\x00\x01\xa0\xf7.\x05\xa2\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x01\xae\x00\x00\x00\x00\x00\x01\x00\x04oW\ \x00\x00\x01\xae\x00\x00\x00\x00\x00\x01\x00\x04oW\
\x00\x00\x01\xa0\xf7.\x05\xa0\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x01\xf2\x00\x00\x00\x00\x00\x01\x00\x04\x8b\xcc\ \x00\x00\x01\xf2\x00\x00\x00\x00\x00\x01\x00\x04\x8b\xcc\
\x00\x00\x01\xa0\xf7.\x05\xa1\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x00v\x00\x02\x00\x00\x00\x03\x00\x00\x00\x13\ \x00\x00\x00v\x00\x02\x00\x00\x00\x03\x00\x00\x00\x13\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x03d\x00\x00\x00\x00\x00\x01\x00\x06\x07\x9a\ \x00\x00\x03d\x00\x00\x00\x00\x00\x01\x00\x06\x07\x9a\
\x00\x00\x01\xa0\xf7.\x05\xb0\ \x00\x00\x01\xa1U\x80\xce\x0c\
\x00\x00\x036\x00\x00\x00\x00\x00\x01\x00\x05\xf1\x9d\ \x00\x00\x036\x00\x00\x00\x00\x00\x01\x00\x05\xf1\x9d\
\x00\x00\x01\xa0\xf7.\x05\xad\ \x00\x00\x01\xa1U\x80\xce\x0b\
\x00\x00\x03L\x00\x00\x00\x00\x00\x01\x00\x05\xfa\xfa\ \x00\x00\x03L\x00\x00\x00\x00\x00\x01\x00\x05\xfa\xfa\
\x00\x00\x01\xa0\xf7.\x05\xad\ \x00\x00\x01\xa1U\x80\xce\x0b\
\x00\x00\x00v\x00\x02\x00\x00\x00\x07\x00\x00\x00\x17\ \x00\x00\x00v\x00\x02\x00\x00\x00\x07\x00\x00\x00\x17\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x02>\x00\x00\x00\x00\x00\x01\x00\x04\xa2x\ \x00\x00\x02>\x00\x00\x00\x00\x00\x01\x00\x04\xa2x\
\x00\x00\x01\xa0\xf7.\x05\xb1\ \x00\x00\x01\xa1U\x80\xce\x0c\
\x00\x00\x02T\x00\x00\x00\x00\x00\x01\x00\x04\xcb \ \x00\x00\x02T\x00\x00\x00\x00\x00\x01\x00\x04\xcb \
\x00\x00\x01\xa0\xf7.\x05\xad\ \x00\x00\x01\xa1U\x80\xce\x0b\
\x00\x00\x02\xb6\x00\x00\x00\x00\x00\x01\x00\x05#\xf4\ \x00\x00\x02\xb6\x00\x00\x00\x00\x00\x01\x00\x05#\xf4\
\x00\x00\x01\xa0\xf7.\x05\xaf\ \x00\x00\x01\xa1U\x80\xce\x0c\
\x00\x00\x02\x9c\x00\x00\x00\x00\x00\x01\x00\x04\xde\xad\ \x00\x00\x02\x9c\x00\x00\x00\x00\x00\x01\x00\x04\xde\xad\
\x00\x00\x01\xa0\xf7.\x05\xac\ \x00\x00\x01\xa1U\x80\xce\x0b\
\x00\x00\x02&\x00\x00\x00\x00\x00\x01\x00\x04\x9e\x19\ \x00\x00\x02&\x00\x00\x00\x00\x00\x01\x00\x04\x9e\x19\
\x00\x00\x01\xa0\xf7.\x05\xa8\ \x00\x00\x01\xa1U\x80\xce\x09\
\x00\x00\x02\x0a\x00\x00\x00\x00\x00\x01\x00\x04\x91\xb0\ \x00\x00\x02\x0a\x00\x00\x00\x00\x00\x01\x00\x04\x91\xb0\
\x00\x00\x01\xa0\xf7.\x05\xac\ \x00\x00\x01\xa1U\x80\xce\x0b\
\x00\x00\x02v\x00\x00\x00\x00\x00\x01\x00\x04\xd4w\ \x00\x00\x02v\x00\x00\x00\x00\x00\x01\x00\x04\xd4w\
\x00\x00\x01\xa0\xf7.\x05\xac\ \x00\x00\x01\xa1U\x80\xce\x0b\
\x00\x00\x00v\x00\x02\x00\x00\x00\x04\x00\x00\x00\x1f\ \x00\x00\x00v\x00\x02\x00\x00\x00\x04\x00\x00\x00\x1f\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x01\x8e\x00\x00\x00\x00\x00\x01\x00\x045m\ \x00\x00\x01\x8e\x00\x00\x00\x00\x00\x01\x00\x045m\
\x00\x00\x01\xa0\xf7.\x05\xad\ \x00\x00\x01\xa1U\x80\xce\x0b\
\x00\x00\x01j\x00\x00\x00\x00\x00\x01\x00\x04\x11,\ \x00\x00\x01j\x00\x00\x00\x00\x00\x01\x00\x04\x11,\
\x00\x00\x01\xa0\xf7.\x05\xaf\ \x00\x00\x01\xa1U\x80\xce\x0c\
\x00\x00\x01\x22\x00\x00\x00\x00\x00\x01\x00\x03\xb0B\ \x00\x00\x01\x22\x00\x00\x00\x00\x00\x01\x00\x03\xb0B\
\x00\x00\x01\xa0\xf7.\x05\x9e\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x01D\x00\x00\x00\x00\x00\x01\x00\x03\xd0\x82\ \x00\x00\x01D\x00\x00\x00\x00\x00\x01\x00\x03\xd0\x82\
\x00\x00\x01\xa0\xf7.\x05\x9f\ \x00\x00\x01\xa1U\x80\xce\x06\
\x00\x00\x00\xc8\x00\x00\x00\x00\x00\x01\x00\x01\xf5-\ \x00\x00\x00\xc8\x00\x00\x00\x00\x00\x01\x00\x01\xf5-\
\x00\x00\x01\xa14u\xc9@\ \x00\x00\x01\xa1U\x80\xce,\
\x00\x00\x01\x04\x00\x01\x00\x00\x00\x01\x00\x03\x92Q\ \x00\x00\x01\x04\x00\x01\x00\x00\x00\x01\x00\x03\x92Q\
\x00\x00\x01\xa19\xc6y$\ \x00\x00\x01\xa1U\x80\xce+\
\x00\x00\x00\xe6\x00\x00\x00\x00\x00\x01\x00\x02\xba\xc8\ \x00\x00\x00\xe6\x00\x00\x00\x00\x00\x01\x00\x02\xba\xc8\
\x00\x00\x01\xa14u\xc7S\ \x00\x00\x01\xa1U\x80\xce+\
\x00\x00\x00\xaa\x00\x00\x00\x00\x00\x01\x00\x01\x1d\x90\ \x00\x00\x00\xaa\x00\x00\x00\x00\x00\x01\x00\x01\x1d\x90\
\x00\x00\x01\xa14u\xc85\ \x00\x00\x01\xa1U\x80\xce+\
\x00\x00\x00v\x00\x02\x00\x00\x00\x01\x00\x00\x00(\ \x00\x00\x00v\x00\x02\x00\x00\x00\x01\x00\x00\x00(\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x86\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ \x00\x00\x00\x86\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\xa0\xf7.\x05\xab\ \x00\x00\x01\xa1U\x80\xce\x0b\
" "
def qInitResources(): def qInitResources():
+5 -3
View File
@@ -3,7 +3,7 @@
################################################################################ ################################################################################
## Form generated from reading UI file 'KCC.ui' ## Form generated from reading UI file 'KCC.ui'
## ##
## Created by: Qt User Interface Compiler version 6.9.3 ## Created by: Qt User Interface Compiler version 6.12.0
## ##
## WARNING! All changes made in this file will be lost when recompiling UI file! ## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################ ################################################################################
@@ -889,9 +889,11 @@ class Ui_mainWindow(object):
#endif // QT_CONFIG(tooltip) #endif // QT_CONFIG(tooltip)
self.colorBox.setText(QCoreApplication.translate("mainWindow", u"Color mode", None)) self.colorBox.setText(QCoreApplication.translate("mainWindow", u"Color mode", None))
#if QT_CONFIG(tooltip) #if QT_CONFIG(tooltip)
self.titleEdit.setToolTip(QCoreApplication.translate("mainWindow", u"<html><head/><body><p>Default Title</p></body></html>", None)) self.titleEdit.setToolTip(QCoreApplication.translate("mainWindow", u"For one item/fusion, sets the default title and filename.\n"
"\n"
"For multiple files, will enumerate the titles and filenames, e.g. Series 01, Series 02, etc.", None))
#endif // QT_CONFIG(tooltip) #endif // QT_CONFIG(tooltip)
self.titleEdit.setPlaceholderText(QCoreApplication.translate("mainWindow", u"Default Title", None)) self.titleEdit.setPlaceholderText(QCoreApplication.translate("mainWindow", u"Default Title/Series", None))
#if QT_CONFIG(tooltip) #if QT_CONFIG(tooltip)
self.coverFillBox.setToolTip(QCoreApplication.translate("mainWindow", u"Resize cover to exact device resolution by center-cropping to aspect ratio first.\n" self.coverFillBox.setToolTip(QCoreApplication.translate("mainWindow", u"Resize cover to exact device resolution by center-cropping to aspect ratio first.\n"
"May crop top/bottom or left/right depending on source aspect ratio. Not implemented for Kindle Scribe.", None)) "May crop top/bottom or left/right depending on source aspect ratio. Not implemented for Kindle Scribe.", None))
+1 -1
View File
@@ -3,7 +3,7 @@
################################################################################ ################################################################################
## Form generated from reading UI file 'MetaEditor.ui' ## Form generated from reading UI file 'MetaEditor.ui'
## ##
## Created by: Qt User Interface Compiler version 6.9.3 ## Created by: Qt User Interface Compiler version 6.12.0
## ##
## WARNING! All changes made in this file will be lost when recompiling UI file! ## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################ ################################################################################
+16 -28
View File
@@ -1076,8 +1076,7 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
if options.folder_output: if options.folder_output:
ext = '' ext = ''
source_path = Path(srcpath) source_path = Path(srcpath)
if srcpath[-1] == os.path.sep:
srcpath = srcpath[:-1]
if 'Ko' in options.profile and options.format == 'EPUB': if 'Ko' in options.profile and options.format == 'EPUB':
if options.noKepub: if options.noKepub:
# Just use normal epub extension if no_kepub option is true # Just use normal epub extension if no_kepub option is true
@@ -1085,36 +1084,25 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
else: else:
ext = '.kepub.epub' ext = '.kepub.epub'
custom_output_directory = False
if wantedname: if wantedname:
wanted_root, wanted_ext = os.path.splitext(wantedname) abs_path = os.path.abspath(options.output)
# so you could have an output folder with . in the filename if not os.path.exists(abs_path):
if not options.folder_output and wantedname.endswith(ext): os.mkdir(abs_path)
filename = os.path.abspath(wantedname) else:
elif wanted_ext == '.mobi' and ext == '.epub': abs_path = source_path.parent
filename = os.path.abspath(wanted_root + ext)
else:
custom_output_directory = True
abs_path = os.path.abspath(options.output)
if not os.path.exists(abs_path):
os.mkdir(abs_path)
if not wantedname or custom_output_directory: if options.title != 'defaulttitle':
if 'Ko' in options.profile and options.format == 'EPUB': name = options.title
if source_path.is_file(): else:
name = KOBO_TOUCH_DRIVER_REGEX.sub('_', source_path.stem) + tomenumber + ext if source_path.is_file():
else: name = source_path.stem
name = KOBO_TOUCH_DRIVER_REGEX.sub('_', source_path.name) + tomenumber + ext
else: else:
if source_path.is_file(): name = source_path.name
name = source_path.stem + tomenumber + ext
else:
name = source_path.name + tomenumber + ext
if custom_output_directory: if 'Ko' in options.profile and options.format == 'EPUB':
filename = os.path.join(os.path.abspath(options.output), name) name = KOBO_TOUCH_DRIVER_REGEX.sub('_', name)
else:
filename = source_path.with_name(name) filename = os.path.join(abs_path, name + tomenumber + ext)
if os.path.exists(filename): if os.path.exists(filename):
counter = 0 counter = 0