mirror of
https://github.com/YaoFANGUK/video-subtitle-remover.git
synced 2026-04-27 02:57:31 +08:00
添加任务列表组件并优化视频加载逻辑 支持可视化显示字幕区域 整理所有模型, 分别为STTN智能擦除, STTN字幕检测, LAMA, ProPainter, OpenCV 提高处理性能 新增CPU运行模式并优化多语言支持 修复Propainter模式部分视频报错 本次提交新增了CPU运行模式,适用于无GPU加速的场景。同时,优化了多语言支持,新增了日语、韩语、越南语等语言配置文件,并更新了README文档以反映新的运行模式和多语言支持。此外,修复了部分代码逻辑,提升了系统的稳定性和兼容性。
70 lines
3.0 KiB
Python
70 lines
3.0 KiB
Python
from PySide6 import QtWidgets
|
|
from qfluentwidgets import (FluentWindow, PushButton, Slider, ProgressBar, PlainTextEdit,
|
|
setTheme, Theme, FluentIcon, CardWidget, SettingCardGroup,
|
|
ComboBoxSettingCard, SwitchSettingCard, RangeSettingCard,
|
|
PushSettingCard, PrimaryPushSettingCard, OptionsSettingCard,
|
|
FolderListSettingCard, HyperlinkCard, ColorSettingCard,
|
|
CustomColorSettingCard)
|
|
from backend.config import config, tr, HARDWARD_ACCELERATION_OPTION
|
|
from backend.tools.constant import InpaintMode, SubtitleDetectMode
|
|
|
|
class SettingInterface(QtWidgets.QVBoxLayout):
|
|
|
|
def __init__(self, parent):
|
|
super().__init__()
|
|
self.setContentsMargins(16, 16, 16, 16)
|
|
|
|
# 界面语言设置
|
|
self.interface_combo = ComboBoxSettingCard(
|
|
configItem=config.interface,
|
|
icon=FluentIcon.LANGUAGE,
|
|
title=tr["SubtitleExtractorGUI"]["InterfaceLanguage"],
|
|
content="",
|
|
parent=parent,
|
|
texts=config.intefaceTexts.keys(),
|
|
)
|
|
self.addWidget(self.interface_combo)
|
|
|
|
# 处理模式设置
|
|
self.inpaint_mode_combo = ComboBoxSettingCard(
|
|
configItem=config.inpaintMode,
|
|
icon=FluentIcon.GLOBE,
|
|
title=tr["SubtitleExtractorGUI"]["InpaintMode"],
|
|
content="",
|
|
parent=parent,
|
|
texts=[list(tr['InpaintMode'].values())[i] for i,_ in enumerate(config.inpaintMode.validator.options)],
|
|
)
|
|
self.inpaint_mode_combo.setToolTip(tr["SubtitleExtractorGUI"]["InpaintModeDesc"])
|
|
self.addWidget(self.inpaint_mode_combo)
|
|
|
|
self.subtitle_detect_model_combo = ComboBoxSettingCard(
|
|
configItem=config.subtitleDetectMode,
|
|
icon=FluentIcon.SEARCH,
|
|
title=tr["SubtitleExtractorGUI"]["SubtitleDetectMode"],
|
|
content="",
|
|
parent=parent,
|
|
texts=[list(tr['SubtitleDetectMode'].values())[i] for i,_ in enumerate(config.subtitleDetectMode.validator.options)],
|
|
)
|
|
self.addWidget(self.subtitle_detect_model_combo)
|
|
|
|
# 是否启用硬件加速
|
|
self.hardware_acceleration = SwitchSettingCard(
|
|
configItem=config.hardwareAcceleration,
|
|
icon=FluentIcon.SPEED_HIGH,
|
|
title=tr["Setting"]["HardwareAcceleration"],
|
|
content=tr["Setting"]["HardwareAccelerationDesc"],
|
|
parent=parent
|
|
)
|
|
self.addWidget(self.hardware_acceleration)
|
|
# 如果硬件加速选项被禁用, 设置硬件加速为False并只读
|
|
if not HARDWARD_ACCELERATION_OPTION:
|
|
self.hardware_acceleration.switchButton.setChecked(False)
|
|
self.hardware_acceleration.switchButton.setEnabled(False)
|
|
config.set(config.hardwareAcceleration, False)
|
|
# 添加一些空间
|
|
self.addStretch(1)
|
|
|
|
def reset_setting(self):
|
|
"""重置所有设置为默认值"""
|
|
# 这里需要实现重置逻辑
|
|
pass |