Skip to content

Commit 8d138b6

Browse files
committed
🎨✨ 优化用户节目、增加递归读取开关
1 parent 8c7b33a commit 8d138b6

File tree

5 files changed

+66
-10
lines changed

5 files changed

+66
-10
lines changed

src/Episode.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,8 @@ def __init__(
7777

7878
# ?###########################################################
7979
# ? 修复标题中的特殊字符
80-
episode["short_title"] = myStrFilter(episode["short_title"])
81-
self.short_title = episode["short_title"]
82-
episode["title"] = myStrFilter(episode["title"])
83-
self.long_title = episode["title"]
80+
self.short_title = myStrFilter(episode["short_title"])
81+
self.long_title = myStrFilter(episode["title"])
8482

8583
# ?###########################################################
8684
# ? 获取章节名
@@ -157,8 +155,11 @@ def get_default_title(self) -> str:
157155
# ? 修复重复标题
158156
if self.short_title == self.long_title or self.long_title == "":
159157
title = self.short_title
158+
if self.long_title.startswith(self.short_title):
159+
title = self.long_title
160160
else:
161161
title = f"{self.short_title} {self.long_title}"
162+
162163
temp = re.search(r"^(\d+)\s+第(\d+)话", title)
163164
if temp and temp[1] == temp[2]:
164165
title = re.sub(r"^\d+\s+(第\d+话)", r"\1", title)

src/ui/MainGUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def __init__(self, app):
5151
self.setFont(QFont("Microsoft YaHei", 10))
5252

5353
# ? 用于链接信号
54-
self.signal_warning_box.connect(lambda msg: QMessageBox.warning(self, "通知", msg))
55-
self.signal_info_box.connect(lambda msg: QMessageBox.information(self, "警告", msg))
54+
self.signal_warning_box.connect(lambda msg: QMessageBox.warning(self, "警告", msg))
55+
self.signal_info_box.connect(lambda msg: QMessageBox.information(self, "通知", msg))
5656
def _(msg, callback: FunctionType = None):
5757
res = QMessageBox.question(self, "提示", msg, QMessageBox.Yes | QMessageBox.No)
5858
if callback and res == QMessageBox.Yes:

src/ui/PySide_src/mainWindow.ui

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,29 @@ li.checked::marker { content: "\2612"; }
995995
</layout>
996996
</widget>
997997
</item>
998+
<item>
999+
<spacer name="horizontalSpacer_17">
1000+
<property name="orientation">
1001+
<enum>Qt::Orientation::Horizontal</enum>
1002+
</property>
1003+
<property name="sizeType">
1004+
<enum>QSizePolicy::Policy::Preferred</enum>
1005+
</property>
1006+
<property name="sizeHint" stdset="0">
1007+
<size>
1008+
<width>40</width>
1009+
<height>20</height>
1010+
</size>
1011+
</property>
1012+
</spacer>
1013+
</item>
1014+
<item>
1015+
<widget class="QCheckBox" name="checkBox_recursive_read">
1016+
<property name="text">
1017+
<string>递归读取本地漫画仓库</string>
1018+
</property>
1019+
</widget>
1020+
</item>
9981021
<item>
9991022
<spacer name="horizontalSpacer_7">
10001023
<property name="orientation">

src/ui/PySide_src/mainWindow_ui.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,15 @@ def setupUi(self, MainWindow):
642642

643643
self.h_Layout_format_type.addWidget(self.groupBox_save_method)
644644

645+
self.horizontalSpacer_17 = QSpacerItem(40, 20, QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Minimum)
646+
647+
self.h_Layout_format_type.addItem(self.horizontalSpacer_17)
648+
649+
self.checkBox_recursive_read = QCheckBox(self.tab_setting)
650+
self.checkBox_recursive_read.setObjectName(u"checkBox_recursive_read")
651+
652+
self.h_Layout_format_type.addWidget(self.checkBox_recursive_read)
653+
645654
self.horizontalSpacer_7 = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
646655

647656
self.h_Layout_format_type.addItem(self.horizontalSpacer_7)
@@ -1039,6 +1048,7 @@ def retranslateUi(self, MainWindow):
10391048
self.radioButton_save_method_7z.setText(QCoreApplication.translate("MainWindow", u"7z\u538b\u7f29\u5305", None))
10401049
self.radioButton_save_method_Zip.setText(QCoreApplication.translate("MainWindow", u"Zip\u538b\u7f29\u5305", None))
10411050
self.radioButton_save_method_Cbz.setText(QCoreApplication.translate("MainWindow", u"Cbz\u538b\u7f29\u5305", None))
1051+
self.checkBox_recursive_read.setText(QCoreApplication.translate("MainWindow", u"\u9012\u5f52\u8bfb\u53d6\u672c\u5730\u6f2b\u753b\u4ed3\u5e93", None))
10421052
self.label_6.setText(QCoreApplication.translate("MainWindow", u"\u6587\u4ef6\u9644\u52a0\u4fe1\u606f\uff1a", None))
10431053
self.checkBox_exif_info.setText(QCoreApplication.translate("MainWindow", u"\u662f\u5426\u5728\u4fdd\u5b58\u6587\u4ef6\u5c5e\u6027\u4e2d\u8bb0\u5f55\u7ae0\u8282\u6807\u9898\u3001\u4f5c\u8005\u3001\u51fa\u7248\u793e\u7b49\u9644\u52a0\u4fe1\u606f", None))
10441054
self.checkBox_save_meta.setText(QCoreApplication.translate("MainWindow", u"\u662f\u5426\u521b\u5efa\u6f2b\u753b\u5143\u6570\u636e\u6587\u4ef6", None))

src/ui/SettingUI.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
log_path,
2828
logger,
2929
openFileOrDir,
30+
getRamdomKaomojis
3031
)
3132

3233
if TYPE_CHECKING:
@@ -59,6 +60,8 @@ def __init__(self, mainGUI: MainGUI):
5960
self.init_img_format_setting()
6061
self.init_rename_rule_setting()
6162
self.init_hash_check_setting()
63+
self.init_recursive_read_setting()
64+
6265
self.qr_ui = QrCodeUI()
6366

6467
############################################################
@@ -469,7 +472,7 @@ def _(text: str) -> None:
469472
self.mainGUI.comboBox_theme_density.setEnabled(True)
470473
self.mainGUI.signal_warning_box.emit(
471474
f"已成功切换主题至 [{text}]!\n"
472-
f"除默认主题外其他主题尚未完整测试,如若找不到切换选项,请缩放启动器窗口或全屏"
475+
f"除默认主题外其他主题尚未完整测试,如若找不到切换选项,请缩放启动器窗口或全屏 {getRamdomKaomojis("sad")}"
473476
)
474477

475478
self.mainGUI.comboBox_theme_style.currentTextChanged.connect(_)
@@ -571,7 +574,7 @@ def init_rename_rule_setting(self) -> None:
571574
def _(rename_rule: str) -> None:
572575
self.mainGUI.updateConfig("rename_rule", reversed_rename_rule_list[rename_rule])
573576
self.mainGUI.signal_warning_box.emit(
574-
f"请注意!修改命名格式后,无法识别现有的已下载文件",
577+
f"请注意!修改命名格式后,无法识别现有的已下载文件 {getRamdomKaomojis("helpless")}",
575578
)
576579

577580
self.mainGUI.comboBox_epi_rename_rule.currentTextChanged.connect(_)
@@ -610,7 +613,7 @@ def _(img_format: str) -> None:
610613
or img_format.endswith("avif")
611614
):
612615
self.mainGUI.signal_warning_box.emit(
613-
f"请注意!PDF格式保存时,非JPG格式文件会被二次压缩为JPG编码存入PDF",
616+
f"请注意!PDF格式保存时,非JPG格式文件会被二次压缩为JPG编码存入PDF {getRamdomKaomojis("helpless")}",
614617
)
615618

616619
self.mainGUI.comboBox_img_format.currentTextChanged.connect(_)
@@ -628,8 +631,27 @@ def init_hash_check_setting(self) -> None:
628631
def _(checked: bool) -> None:
629632
if not checked:
630633
self.mainGUI.signal_warning_box.emit(
631-
f"请注意!图片下载完整性校验已取消,可能会造成缺页与其它预料之外的严重问题!",
634+
f"请注意!图片下载完整性校验已取消,可能会造成缺页与其它预料之外的严重问题! {getRamdomKaomojis("shock")}",
632635
)
633636
self.mainGUI.updateConfig("hash_check", checked)
634637

635638
self.mainGUI.checkBox_hash_check.toggled.connect(_)
639+
640+
############################################################
641+
642+
def init_recursive_read_setting(self) -> None:
643+
"""绑定递归读取漫画仓库设置"""
644+
flag = self.mainGUI.getConfig("recursive_read")
645+
if flag is not None:
646+
self.mainGUI.checkBox_recursive_read.setChecked(flag)
647+
else:
648+
self.mainGUI.updateConfig("recursive_read", True)
649+
650+
def _(checked: bool) -> None:
651+
if checked:
652+
self.mainGUI.signal_warning_box.emit(
653+
f"递归读取漫画仓库后,将会对仓库路径下所有子文件夹都进行检测,可能会造成性能负担! {getRamdomKaomojis("helpless")}",
654+
)
655+
self.mainGUI.updateConfig("recursive_read", checked)
656+
657+
self.mainGUI.checkBox_recursive_read.toggled.connect(_)

0 commit comments

Comments
 (0)