KINDNICK 86cf438785 v2.3.2: fix HelpView showing blank window (regression in v2.3.1)
In v2.3.1 the new 'Re-run Onboarding' button was added but the
self.setLayout(main_layout) line was accidentally indented into the
new _reopen_onboarding method body, so init_ui returned without
applying the layout. Result: F1 opened an empty dialog with no tabs.

Move setLayout back to the end of init_ui.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 18:12:51 +09:00

98 lines
3.1 KiB
Python

"""
사용 설명 가이드 창.
i18n 사전(_HELP_HTML)에서 ko/en HTML을 가져와 6개 탭으로 표시.
"""
from PyQt5.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel,
QPushButton, QWidget, QTabWidget, QTextBrowser)
from PyQt5.QtCore import Qt
from core.i18n import tr, tr_html
from ui.styles import apply_dark_titlebar
class HelpView(QDialog):
"""사용 설명 가이드 다이얼로그"""
# (사전 키, 탭 라벨 키)
_TABS = [
('help.html.intro', 'help.tab_intro'),
('help.html.work_hours', 'help.tab_work_hours'),
('help.html.overtime', 'help.tab_overtime'),
('help.html.leave', 'help.tab_leave'),
('help.html.break', 'help.tab_break'),
('help.html.faq', 'help.tab_faq'),
]
def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle(tr('window.help'))
self.setModal(True)
self.setMinimumSize(680, 720)
self.init_ui()
apply_dark_titlebar(self)
def init_ui(self):
main_layout = QVBoxLayout()
main_layout.setContentsMargins(0, 0, 0, 0)
main_layout.setSpacing(0)
title = QLabel(tr('window.help'))
title.setObjectName("dialog_title")
title.setAlignment(Qt.AlignCenter)
main_layout.addWidget(title)
tabs = QTabWidget()
tabs.setDocumentMode(True)
for html_key, tab_label_key in self._TABS:
tabs.addTab(self._make_tab(tr_html(html_key)), tr(tab_label_key))
main_layout.addWidget(tabs)
button_layout = QHBoxLayout()
button_layout.setContentsMargins(20, 10, 20, 20)
# 온보딩 다시 보기 (왼쪽)
onboarding_button = QPushButton("🚀 온보딩 다시 보기")
onboarding_button.setMinimumHeight(40)
onboarding_button.clicked.connect(self._reopen_onboarding)
button_layout.addWidget(onboarding_button)
button_layout.addStretch()
close_button = QPushButton(tr('btn.close'))
close_button.setObjectName("btn_primary")
close_button.setMinimumHeight(40)
close_button.setMinimumWidth(120)
close_button.clicked.connect(self.close)
button_layout.addWidget(close_button)
main_layout.addLayout(button_layout)
self.setLayout(main_layout)
def _reopen_onboarding(self):
"""부모 윈도우의 show_onboarding 호출 후 도움말 닫음."""
self.close()
if self.parent() and hasattr(self.parent(), 'show_onboarding'):
self.parent().show_onboarding()
def _make_tab(self, html: str) -> QWidget:
container = QWidget()
layout = QVBoxLayout()
layout.setContentsMargins(16, 12, 16, 12)
browser = QTextBrowser()
browser.setOpenExternalLinks(False)
browser.setHtml(html)
layout.addWidget(browser)
container.setLayout(layout)
return container
# 단독 실행 테스트
if __name__ == "__main__":
import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
dialog = HelpView()
dialog.exec_()