Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions assets/i18n/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"CUDA 加速": "CUDA",
"检测器与修补说明": "Detector and repair comparison",
"CUDA 快速检测器在 GPU 上检测更快,能用笔画像素限定擦除范围。日漫样本中文字框覆盖较少,漏检处可能留字。\n\n轻量双图检测器在 CPU 上检测更快,日漫样本中文字框覆盖更全。它靠文字框和文字行定位,复杂底纹或描边仍可能漏擦。\n\n两套方案共用背景修补流程,主要区别在于擦除范围。": "The fast CUDA detector runs faster on GPU and identifies stroke pixels to guide erasing. It covered fewer text regions in the Japanese manga sample, so missed text may remain.\n\nThe lightweight dual detector runs faster on CPU and covered more text regions in the sample. It uses text boxes and lines, so it can miss strokes on textured backgrounds or in outlined text.\n\nBoth detectors use the same background repair process. They mainly differ in what gets erased.",
"下次任务生效。自动检测模式会按 CUDA 是否可用选择模型。": "Applies to the next job. Auto detection selects a model based on CUDA availability.",
"CUDA 设置未保存": "CUDA setting not saved",
"CUDA 设置未保存:{_0}": "Could not save the CUDA setting: {_0}",
Expand Down
2 changes: 2 additions & 0 deletions assets/i18n/ja.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"CUDA 加速": "CUDA 加速",
"检测器与修补说明": "検出器と修復の違い",
"CUDA 快速检测器在 GPU 上检测更快,能用笔画像素限定擦除范围。日漫样本中文字框覆盖较少,漏检处可能留字。\n\n轻量双图检测器在 CPU 上检测更快,日漫样本中文字框覆盖更全。它靠文字框和文字行定位,复杂底纹或描边仍可能漏擦。\n\n两套方案共用背景修补流程,主要区别在于擦除范围。": "高速 CUDA 検出器は GPU での検出が速く、文字の画素を使って消去範囲を絞ります。日本の漫画サンプルでは文字領域のカバー率が低く、検出漏れの文字が残ることがあります。\n\n軽量の二段階検出器は CPU での検出が速く、サンプルではより多くの文字領域をカバーしました。文字枠と行で位置を特定するため、複雑な背景や縁取り文字では一部が残ることがあります。\n\n背景の修復処理は共通で、主な違いは文字を消去する範囲です。",
"下次任务生效。自动检测模式会按 CUDA 是否可用选择模型。": "次回の処理から適用されます。自動検出では CUDA の利用可否に応じてモデルを選びます。",
"CUDA 设置未保存": "CUDA 設定は未保存",
"CUDA 设置未保存:{_0}": "CUDA 設定を保存できませんでした:{_0}",
Expand Down
33 changes: 28 additions & 5 deletions comic_translate_desktop/ui/main_window.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations
from ..i18n import tr, ui_language

from html import escape
from pathlib import Path
import json
import random
Expand Down Expand Up @@ -331,7 +332,7 @@ def _build_work_panel(self) -> QWidget:
self._control_grid.setContentsMargins(0, 0, 0, 0)
self._control_grid.setHorizontalSpacing(10)
self._control_grid.setVerticalSpacing(4)
self._controls_inline = None
self._controls_mode = None
self._language_controls = QWidget()
control_row = QGridLayout(self._language_controls)
self._language_grid = control_row
Expand Down Expand Up @@ -378,7 +379,22 @@ def _build_work_panel(self) -> QWidget:
self._cuda_toggle.setChecked(self.config['use_gpu'])
self._cuda_toggle.setToolTip(tr('下次任务生效。自动检测模式会按 CUDA 是否可用选择模型。'))
self._cuda_toggle.toggled.connect(self._toggle_cuda)
quick_layout.addWidget(self._cuda_toggle)
cuda_note = tr(
'CUDA 快速检测器在 GPU 上检测更快,能用笔画像素限定擦除范围。日漫样本中文字框覆盖较少,漏检处可能留字。\n\n'
'轻量双图检测器在 CPU 上检测更快,日漫样本中文字框覆盖更全。它靠文字框和文字行定位,复杂底纹或描边仍可能漏擦。\n\n'
'两套方案共用背景修补流程,主要区别在于擦除范围。')
self._cuda_help = QLabel('?')
self._cuda_help.setObjectName('cudaHelp')
self._cuda_help.setFixedSize(18, 18)
self._cuda_help.setAlignment(Qt.AlignCenter)
self._cuda_help.setAccessibleName(tr('检测器与修补说明'))
self._cuda_help.setAccessibleDescription(cuda_note)
self._cuda_help.setToolTip('<p>' + '</p><p>'.join(escape(cuda_note).split('\n\n')) + '</p>')
cuda_layout = QHBoxLayout()
cuda_layout.setSpacing(4)
cuda_layout.addWidget(self._cuda_toggle)
cuda_layout.addWidget(self._cuda_help, 0, Qt.AlignVCenter)
quick_layout.addLayout(cuda_layout)
quick_layout.addWidget(self._pref_toggle)
control_row.setColumnStretch(5, 1)
self._control_divider = QFrame()
Expand Down Expand Up @@ -1368,7 +1384,8 @@ def _apply_compact_layout(self):
self._settings_btn.setVisible(self.width() >= 960)
self._logs_btn.setVisible(self.width() >= 960)
inline = self.width() >= (1400 if ui_language() == 'en' else 1280 if ui_language() == 'ja' else 1180)
stacked = not inline and ui_language() != 'zh-CN'
controls_mode = 'inline' if inline else 'narrow' if self.width() < 880 else 'split'
stacked = controls_mode == 'split' and ui_language() != 'zh-CN'
if stacked != self._language_stacked:
self._language_stacked = stacked
fields = (self._source_caption, self._source_language, self._language_arrow,
Expand All @@ -1389,8 +1406,8 @@ def _apply_compact_layout(self):
self._language_grid.addWidget(self._target_language, 0, 4)
self._language_arrow.setVisible(True)
self._language_grid.setColumnStretch(5, 1)
if inline != self._controls_inline:
self._controls_inline = inline
if controls_mode != self._controls_mode:
self._controls_mode = controls_mode
for widget in (self._language_controls, self._output_controls, self._start_btn,
self._quick_options, self._control_divider):
self._control_grid.removeWidget(widget)
Expand All @@ -1401,6 +1418,12 @@ def _apply_compact_layout(self):
self._control_grid.addWidget(self._quick_options, 0, 3)
self._control_grid.addWidget(self._start_btn, 0, 4)
self._control_divider.setVisible(True)
elif controls_mode == 'narrow':
self._control_grid.addWidget(self._language_controls, 0, 0, 1, 5)
self._control_grid.addWidget(self._quick_options, 1, 0, 1, 3, Qt.AlignLeft)
self._control_grid.addWidget(self._start_btn, 1, 3, 1, 2, Qt.AlignRight)
self._control_grid.addWidget(self._output_controls, 2, 0, 1, 5)
self._control_divider.setVisible(False)
else:
self._control_grid.addWidget(self._language_controls, 0, 0, 1, 3)
self._control_grid.addWidget(self._quick_options, 0, 3, 1, 2, Qt.AlignRight)
Expand Down
3 changes: 3 additions & 0 deletions comic_translate_desktop/ui/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ def refresh_themed_icons():
QFrame#controlCard QPushButton[role="primary"] { border-radius: 10px; min-height: 32px; }
QFrame#optionDivider { background: @rule; border: none; margin: 6px 0; }
QLabel#optionArrow { color: @secondary; padding: 0 2px; }
QLabel#cudaHelp { background: @muted; color: @secondary; border: 1px solid @rule;
border-radius: 9px; font-size: 11px; font-weight: 700; }
QLabel#cudaHelp:hover { color: @ink; border-color: @ruleStrong; }
QComboBox QLineEdit#fontSearchEditor, QComboBox QLineEdit#fontSearchEditor:focus { padding: 0; min-height: 0; border: none; border-radius: 0; background: transparent; }
QLineEdit#fontSearchEditor QToolButton { padding: 0; min-height: 0; min-width: 0; border: none; border-radius: 0; background: transparent; }
QSpinBox::up-button, QSpinBox::down-button { width: 20px; border: none; background: transparent; }
Expand Down
1 change: 1 addition & 0 deletions docs/UI_UPGRADE_PLAN_2026-11-06.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- [x] 一键精修:自动处理页把上次任务的图片 / PDF 一次加入嵌字精修列表;翻译偏好展开改为高度动画,大窗口保留日志面板,去掉透明度效果与面板跳变
- [x] 精修框选填色:修复工具栏新增「填白 / 填黑」,把框选区域整块填成纯色并支持撤回,适配简单背景
- [x] 自动处理页新增 CUDA 开关,设置即时保存并在下一次任务生效;详细配置保留检测器的自动模式,窄窗保留模型浏览按钮,一键精修可跳过无效文件。
- [x] CUDA 开关旁新增悬停问号,说明两套检测器对擦字范围和速度的影响。

---

Expand Down
7 changes: 5 additions & 2 deletions scripts/review_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def capture(name, page, buttons=()):
QTest.qWait(80)
for button in buttons:
check_action(window, button)
if page is window.translate_tab:
for field in (window._source_language, window._target_language):
assert window._language_controls.rect().contains(field.geometry())
header_widgets = [widget for widget in (window._brand_title, window._nav_auto, window._nav_editor,
window.status_pill, window._stop_btn, window._settings_btn, window._logs_btn,
window._output_btn, window._issue_btn, window._more_btn) if widget.isVisible()]
Expand Down Expand Up @@ -123,7 +126,7 @@ def review():
report['illustrations'].append(dict(file=asset, width=pixmap.width(),
height=pixmap.height(), transparent=True))
capture('automatic', window.translate_tab,
(window._add_btn, window._cuda_toggle, window._start_btn))
(window._add_btn, window._cuda_toggle, window._cuda_help, window._start_btn))
window._pref_toggle.setChecked(True)
QTest.qWait(320)
capture('automatic-preferences', window.translate_tab,
Expand Down Expand Up @@ -301,7 +304,7 @@ def review():
for width, height in ((1024, 720), (960, 540), (820, 480)):
window.resize(min(width, int(screen.width() * .94)), min(height, int(screen.height() * .94)))
capture(f'automatic-{width}', window.translate_tab,
(window._add_btn, window._cuda_toggle, window._start_btn))
(window._add_btn, window._cuda_toggle, window._cuda_help, window._start_btn))
settings._sections.setCurrentIndex(2)
capture(f'settings-{width}', settings, (settings._save_btn,))
settings._sections.setCurrentIndex(3)
Expand Down
Loading